Commit Graph

789 Commits

Author SHA1 Message Date
Jean Boussier d839ddb71a Refactor `ActionController::RateLimiting` to use `AS::Cache`
Given that the limiter implementation provided by Kredis is a simple
increment with a limit, all `ActiveSupport::Cache` already provide that
same capability, with a wide range of backing stores, and not just Redis.

This even allow to use SolidCache has a backend if you so desire.

If we feel particularly fancy, we could also accept a more generic
limiter interface to better allow users to swap the implementation
for better algorithms such as leaky-bucket etc.
2024-01-17 15:40:49 +01:00
Dorian Marié 420b19a255 Upgrade minitest from 5.20.0 to 5.21.1 to fix mutex_m deprecation 2024-01-12 16:49:20 +01:00
Jean Boussier dcd13fc8ee Relock Gemfile on Ruby 3.3.0
Google hasn't shipped precompile binaries
for Ruby 3.3.0 yet, so it confuses bundler...
2024-01-09 23:58:10 +01:00
Rafael Mendonça França b1479e412d
Remove redundant version constraint on mail gem 2024-01-09 19:41:52 +00:00
Earlopain 45f64f5a0a
Remove workaround for `mail` gem dependencies
d9d8dcc6ba
https://github.com/rails/rails/pull/44083

Remove backwards compat workaround for versions earlier than 2.8.0
2024-01-09 13:25:36 +01:00
Earlopain 46021105c7
Bump libxml-ruby
This fixes bundle install when using libxml2 2.12.0
2024-01-08 09:34:11 +01:00
Hartley McGuire 66c174557a
bundle update (#50516)
This commit is meant to accomplish two things:
- update gems with precompiled C extensions (nokogiri) so that Rails'
  lockfile can be `bundle install`d on Ruby 3.3
- remove some Gemfile conditionals for Ruby < 3 now that 3.1 is the
  minimum version

Additionally, a requirement is added to ignore mdl 0.13.0 because it
raises false positive warnings. The commit introducing those warnings
has been reverted but there has not been a release since the revert.
2024-01-02 16:48:44 +01:00
Hartley McGuire 90da071bb6
bundle update rubocop --conservative (#50515)
Also perform two autocorrects with `bundle exec rubocop -A`:

- fixes a new case of [`Style/RedundantReturn`][1]
- fixes a new case of [`Performance/StringInclude`][2]

[1]: 146b1c2e33
[2]: 3158bbb9f6

Co-authored-by: David Heinemeier Hansson <david@basecamp.com>
2024-01-02 12:49:36 +01:00
Jonathan Hefner d4cae83a17 Add brakeman as development dependency
Follow-up to #50507.

Since `brakeman` is now included in generated apps by default, it must
be installed before running Rails tests that invoke `bin/rails` for
generated apps.

This fixes CI failures such as:

  ```
  Error:
  AppGeneratorTest#test_app_update_does_not_change_app_name_when_app_name_is_hyphenated_name:
  RuntimeError: Command failed with exit 1: yes | bin/rails app:update
      test/generators/app_generator_test.rb:1304:in `system'
      test/generators/app_generator_test.rb:1304:in `block (2 levels) in run_app_update'
      test/generators/app_generator_test.rb:1304:in `block in run_app_update'
      test/generators/app_generator_test.rb:1299:in `chdir'
      test/generators/app_generator_test.rb:1299:in `run_app_update'
      test/generators/app_generator_test.rb:430:in `test_app_update_does_not_change_app_name_when_app_name_is_hyphenated_name'
  ```
2024-01-01 12:00:10 -06:00
David Heinemeier Hansson e3da4fc53d
Add allow_browser to set minimum versions for your application (#50505)
* Add allow_browser to set minimum versions for your application
2023-12-31 19:19:16 +01:00
zzak cbd8bd735c
Add rubocop-rails-omakase as development dependency (#50495)
This gem is used in Railties tests so it must be a development dependency.
Due to the fixture rails app tmp/rails/app_template faking Bundler and using the repo's Gemfile:
0fb5f67ac4/railties/test/isolation/abstract_unit.rb (L618-L622)

See also: e4b0488851
2023-12-31 18:18:17 +01:00
David Heinemeier Hansson 179b979ddb
Add rate limiting to Action Controller via the Kredis limiter type (#50490)
* Add rate limiting via the Kredis limiter type
2023-12-31 13:26:01 +01:00
Jonathan Hefner adf10e9406 Bump psych gem to 5.1.2
This fixes the following error for the guides build:

  ```
  Traceback (most recent call last):
    13: from bug_report_templates/action_controller.rb:5:in `<main>'
    12: from /usr/local/bundle/gems/bundler-2.4.22/lib/bundler/inline.rb:42:in `gemfile'
    11: from /usr/local/bundle/gems/bundler-2.4.22/lib/bundler.rb:403:in `with_unbundled_env'
    10: from /usr/local/bundle/gems/bundler-2.4.22/lib/bundler.rb:649:in `with_env'
     9: from /usr/local/bundle/gems/bundler-2.4.22/lib/bundler.rb:403:in `block in with_unbundled_env'
     8: from /usr/local/bundle/gems/bundler-2.4.22/lib/bundler/inline.rb:51:in `block in gemfile'
     7: from /usr/local/bundle/gems/bundler-2.4.22/lib/bundler/settings.rb:142:in `temporary'
     6: from /usr/local/bundle/gems/bundler-2.4.22/lib/bundler/inline.rb:66:in `block (2 levels) in gemfile'
     5: from /usr/local/bundle/gems/bundler-2.4.22/lib/bundler/runtime.rb:24:in `setup'
     4: from /usr/local/bundle/gems/bundler-2.4.22/lib/bundler/runtime.rb:24:in `map'
     3: from /usr/local/bundle/gems/bundler-2.4.22/lib/bundler/spec_set.rb:165:in `each'
     2: from /usr/local/bundle/gems/bundler-2.4.22/lib/bundler/spec_set.rb:165:in `each'
     1: from /usr/local/bundle/gems/bundler-2.4.22/lib/bundler/runtime.rb:25:in `block in setup'
  /usr/local/bundle/gems/bundler-2.4.22/lib/bundler/runtime.rb:304:in `check_for_activated_spec!': You have already activated psych 5.1.1.1, but your Gemfile requires psych 5.1.2. Prepending `bundle exec` to your command may solve this. (Gem::LoadError)
  ```

This is similar to #45052.  Eventually, this should be fixed permanently
by either rubygems/rubygems#5529 or rubygems/rubygems#5535.
2023-12-19 18:03:51 -06:00
Yasuo Honda cd5a698c4b
Revert "Lock `bigdecimal` version to 3.1.4 or lower" 2023-12-17 15:05:47 +09:00
Yasuo Honda 04ab0b58fd Lock `bigdecimal` version to 3.1.4
This commit addresses the Rails CI using Ruby master branch failure
because Rails CI enables `RAILS_STRICT_WARNINGS` to raise RuntimeError for warnings.

https://buildkite.com/rails/rails/builds/102621#018c49df-e3de-4c2f-aeb7-6d8f08997da9/1102-1107
```ruby
/rails/activesupport/lib/active_support/core_ext/big_decimal/conversions.rb:4: warning: bigdecimal/util is found in bigdecimal, which will no longer be part of the default gems since Ruby 3.4.0. Add bigdecimal to your Gemfile or gemspec. (RuntimeError)
```

According to https://bugs.ruby-lang.org/issues/20058 ,
This failure has been triggered since cc9826503d
and it will be addressed once the bigdecimal 3.1.5 is available at rubygems.org .

In the meantime, we can workaround this issue by logking `bigdecimal` version to 3.1.4 or lower.
This commit should be reverted when the `bigdecimal` 3.1.5 is available at rubygems.org .
2023-12-12 11:45:37 +09:00
Stan Lo 6be6669c95
Use IRB 1.10.1 to avoid console test issues on CI 2023-12-05 16:36:27 +00:00
Jean Boussier 1aa4bd3823 Lock irb to < 1.10 for now
It breaks various `rails console` related integration tests:

```
Failure:
FullStackConsoleTest#test_sandbox [test/application/console_test.rb:123]:
"> " expected, but got:

(END).
Expected "\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n--More--\r        \r(END)" to include "> ".
```

I tried to figure out a fix, but ran out of time, so in order
to fix CI we can lock IRB for now.
2023-12-05 16:31:01 +01:00
eileencodes a8e07924d6 Fix dependency on JSON gem
Don't use `json` 2.7.0 release that has a regression.

Ref: https://github.com/flori/json/pull/554
2023-12-02 09:41:55 +01:00
Jonathan Hefner 3cac3c3397 Update SDoc to latest revision 2023-11-14 16:08:31 -06:00
Jean Boussier 7ae4a5f3b5 Automatically eager load TZInfo
On the first call it can be a bit slow because it needs to load
a bunch of data. It's also better to do it as part of boot
so that some of that data is shared via Copy-on-Write
2023-11-09 18:44:27 +01:00
Yasuo Honda 36c49b3cf5 Bump timeout to 0.4.1
This commit addresses the following CI failure
https://buildkite.com/rails/rails/builds/101658#018ba903-f8d8-4187-929c-fc7996bb17f3

- Without this fix
```
$ ruby -v
ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x86_64-linux]
$ cd guides/bug_report_templates
$ ruby action_controller_gem.rb
... snip
/home/yahonda/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.3.22/lib/bundler/runtime.rb:308:in `check_for_activated_spec!': You have already activated timeout 0.3.1, but your Gemfile requires timeout 0.4.1. Since timeout is a default gem, you can either remove your dependency on it or try updating to a newer version of bundler that supports timeout as a default gem. (Gem::LoadError)
	from /home/yahonda/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.3.22/lib/bundler/runtime.rb:25:in `block in setup'
	from /home/yahonda/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.3.22/lib/bundler/spec_set.rb:155:in `each'
	from /home/yahonda/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.3.22/lib/bundler/spec_set.rb:155:in `each'
	from /home/yahonda/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.3.22/lib/bundler/runtime.rb:24:in `map'
	from /home/yahonda/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.3.22/lib/bundler/runtime.rb:24:in `setup'
	from /home/yahonda/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.3.22/lib/bundler/inline.rb:66:in `block in gemfile'
	from /home/yahonda/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.3.22/lib/bundler/settings.rb:131:in `temporary'
	from /home/yahonda/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.3.22/lib/bundler/inline.rb:50:in `gemfile'
	from action_controller_gem.rb:5:in `<main>'
$
```
2023-11-08 11:01:58 +09:00
Rafael Mendonça França 403447d061
Use version of importmap that support loading outside of an app
We are using it in a few scripts, and we were doing workarounds
to be able to use outside an Rails application.

Now the workaround is gone.
2023-10-27 20:23:42 +00:00
Jonathan Hefner ad1e443e53 Update SDoc to latest revision 2023-10-21 16:00:16 -05:00
Hartley McGuire 5005480adf
Add racc dependency because it will be bundled
Ruby 3.3.0 is going to start warning for racc not being specififed as a
dependency, and Ruby 3.4.0 will raise if it is not specified.

This commit prevents those issues by adding racc to the Action Pack
gemspec, since `racc/parser` is a runtime dependency of the Journey
parser.
2023-10-20 12:59:18 -04:00
Jean Boussier bcdeea5da7 Drop dependency on mutex_m
It used to be stdlib but is being extracted in modern rubies.

Overall its usefulness is dubious. In all cases it is included in
Rails, it's only for the `synchronize` method, but end up exposing
a dozen other useless methods.

In the end just using a Mutex is clearer and simpler.

In some cases we can even get away with a single mutex in a constant.
2023-10-18 14:27:26 +02:00
Yasuo Honda e9106d0b20 Bump psych to 5.1.1.1
This commit addresses action_controller_gem.rb failure by updating psych as follows.
`$ bundle update psych --conservative`

Refer to https://buildkite.com/rails/rails/builds/100884#018b3a84-f1c5-4461-839c-5cfbe26ee001/1092-1125

- Without this commit
```
$ ruby -v
ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x86_64-linux]
$ cd guides/bug_report_templates
$ ruby action_controller_gem.rb
Fetching gem metadata from https://rubygems.org/...........
... snip ...
Using rails 7.1.1
/home/yahonda/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.3.22/lib/bundler/runtime.rb:308:in `check_for_activated_spec!': You have already activated psych 5.1.0, but your Gemfile requires psych 5.1.1.1. Prepending `bundle exec` to your command may solve this. (Gem::LoadError)
	from /home/yahonda/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.3.22/lib/bundler/runtime.rb:25:in `block in setup'
	from /home/yahonda/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.3.22/lib/bundler/spec_set.rb:155:in `each'
	from /home/yahonda/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.3.22/lib/bundler/spec_set.rb:155:in `each'
	from /home/yahonda/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.3.22/lib/bundler/runtime.rb:24:in `map'
	from /home/yahonda/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.3.22/lib/bundler/runtime.rb:24:in `setup'
	from /home/yahonda/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.3.22/lib/bundler/inline.rb:66:in `block in gemfile'
	from /home/yahonda/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.3.22/lib/bundler/settings.rb:131:in `temporary'
	from /home/yahonda/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.3.22/lib/bundler/inline.rb:50:in `gemfile'
	from action_controller_gem.rb:5:in `<main>'
$
```
2023-10-17 08:44:14 +09:00
fatkodima b8829cabec Enable `Style/RedundantDoubleSplatHashBraces` rubocop cop 2023-10-11 14:55:00 +03:00
Jonathan Hefner 2533044859 Update SDoc to latest revision 2023-10-08 13:49:43 -05:00
Usman 24b99910cf No need to include error_highlight when ruby version >= 3.2 2023-09-29 09:05:06 +00:00
Rafael Mendonça França fb6c6007d0
Development of Rails 7.2 starts now
🎉
2023-09-27 03:59:11 +00:00
Rafael Mendonça França e5386cb402
Preparing for 7.1.0.rc1 release 2023-09-27 03:08:31 +00:00
zzak 5c2a112d37
Import rails-bin to internal tools/
Co-authored-by: zzak <zzakscott@gmail.com>
2023-09-13 01:57:16 +00:00
Rafael Mendonça França 699dfdb426
Preparing for 7.1.0.beta1 release 2023-09-13 00:36:01 +00:00
Mike Dalessio 64169655c7
dep: bump sqlite3 dependency
sqlite3-ruby v1.6.6 has sqlite 3.43.1 which fixes the AVG() bug
described in https://github.com/sparklemotion/sqlite3-ruby/issues/396

See related https://github.com/rails/rails/pull/49048
2023-09-12 14:18:13 -04:00
Cody Cutrer 6adfe05f9e Update mysql2 gem
So that it can find the mysql libraries with homebrew on arm64
2023-09-06 13:27:27 -06:00
Rafael Mendonça França e4d47eaecf
Revert "Lock globalid gem version to address broken CI"
This reverts commit 6440efa9ea.
2023-09-05 16:17:49 +00:00
Ryuta Kamizono 6440efa9ea Lock globalid gem version to address broken CI
Broken CI is due to https://github.com/rails/globalid/pull/163 in
globalid 1.2.0.

https://buildkite.com/rails/rails/builds/99329#018a5f01-a966-4424-9596-0a7f1deeb1ff/1178-1190
2023-09-04 16:40:19 +09:00
Rafael Mendonça França 7459392bf1
Use the released version of trilogy 2023-09-01 20:39:50 +00:00
Rafael Mendonça França 4aa1625edd
Always install sdoc from git
The EDGE environment variable isn't set when installing the gems.
Since this branch is the edge branch, we don't need this environment
variable.
2023-08-28 15:29:58 +00:00
zzak 0f580a20fe
Try to build with sqlite3 1.6.3 2023-08-27 09:29:29 +09:00
Koichi ITO a77535c74c Add bigdecimal to runtime dependency
## Motivation / Background

Follow up 1c93288f8b.

This PR adds bigdecimal to runtime dependency of Active Support to suppress the following Ruby 3.3.0dev's warning.

> /Users/koic/.rbenv/versions/3.3.0-dev/lib/ruby/gems/3.3.0+0/bundler/gems/rails-a8871e6829e5/activesupport/lib/
> active_support/core_ext/object/json.rb:5: warning: bigdecimal will be not part of the default gems since Ruby 3.4.0.
> Add bigdecimal to your Gemfile. Also contact author of  to add bigdecimal into its gemspec.

The grep yields the following results:

```console
$ git grep 'require.*bigdecimal'
activejob/lib/active_job/arguments.rb:3:require "bigdecimal"
activejob/lib/active_job/serializers/big_decimal_serializer.rb:3:require "bigdecimal"
activejob/test/cases/argument_serialization_test.rb:3:require "bigdecimal"
activemodel/lib/active_model/type/decimal.rb:3:require "bigdecimal/util"
activemodel/lib/active_model/validations/numericality.rb:5:require "bigdecimal/util"
activemodel/test/cases/validations/numericality_validation_test.rb:8:require "bigdecimal"
activerecord/test/cases/adapters/sqlite3/quoting_test.rb:4:require "bigdecimal"
activerecord/test/cases/arel/visitors/to_sql_test.rb:4:require "bigdecimal"
activerecord/test/cases/migration_test.rb:5:require "bigdecimal/util"
activesupport/lib/active_support/core_ext/big_decimal/conversions.rb:3:require "bigdecimal"
activesupport/lib/active_support/core_ext/big_decimal/conversions.rb:4:require "bigdecimal/util"
activesupport/lib/active_support/core_ext/object/json.rb:5:require "bigdecimal"
activesupport/lib/active_support/message_pack/extensions.rb:3:require "bigdecimal"
activesupport/lib/active_support/xml_mini.rb:5:require "bigdecimal"
activesupport/lib/active_support/xml_mini.rb:6:require "bigdecimal/util"
activesupport/test/core_ext/hash_ext_test.rb:4:require "bigdecimal"
activesupport/test/core_ext/object/duplicable_test.rb:4:require "bigdecimal"
activesupport/test/hash_with_indifferent_access_test.rb:4:require "bigdecimal"
activesupport/test/json/encoding_test_cases.rb:3:require "bigdecimal"
```

By adding only to Active Support as a dependency, it should resolve the issue due to the dependency.

## Detail

The warning is confirmed in the following step:

```ruby
$ cat generic_main.rb
# frozen_string_literal: true

require 'bundler/inline'

gemfile(true) do
  source 'https://rubygems.org'

  git_source(:github) { |repo| "https://github.com/#{repo}.git" }

  gem "rails", github: "rails/rails", branch: "main"
end

require 'active_support'
require 'minitest/autorun'
# These gems will be bundled gems in Ruby 3.4
require 'bigdecimal'
```

Run generic_main.rb with Ruby 3.3.0dev below.

```console
$ ruby -v
ruby 3.3.0dev (2023-08-25T17:47:04Z master 7d32011399) [x86_64-darwin22]

$ ruby generic_main.rb
Fetching gem metadata from https://rubygems.org/.......
Resolving dependencies...
/Users/koic/.rbenv/versions/3.3.0-dev/lib/ruby/gems/3.3.0+0/bundler/gems/rails-a8871e6829e5/activesupport/lib/
active_support/core_ext/object/json.rb:5: warning: bigdecimal will be not part of the default gems since Ruby 3.4.0.
Add bigdecimal to your Gemfile. Also contact author of  to add bigdecimal into its gemspec.
Run options: --seed 39015

# Running:

Finished in 0.001313s, 0.0000 runs/s, 0.0000 assertions/s.
0 runs, 0 assertions, 0 failures, 0 errors, 0 skips
```

## Additional information

It is essentially the same as https://github.com/rails/rails/pull/48907.
2023-08-26 03:40:25 +09:00
Hartley McGuire 2d61a206f4
Fix served_url printed when using Puma & Rack 3
This `#use_puma?` check was [introduced][1] because Rails could
potentially display the wrong server URL in development if another host
or port is configured in `config/puma.rb`.

However, in Rack 3 the the name of the server class changed from
`Rack::Handler::Puma` to `Rackup::Handler::Puma`, which means that the
served_url is being logged again.

This commit fixes the check to accept either version of the class.
Additionally, puma was updated in Gemfile.lock because Puma 6.0.x prints
a deprecation warning about Rack::Handler that's fixed in 6.1.0.

[1]: 29648ff60e
2023-08-17 20:01:19 -04:00
Yasuo Honda 3e52adf28e Add `drb`, `mutex_m` and `base64` that are bundled gem candidates for Ruby 3.4
This commit adds `drb`, `mutex_m` and `base64` to `activesupport/activesupport.gemspec`
because 3.3.0dev shows warnings if bundled gem candidates are required
like `mutex_m will be not part of the default gems since Ruby 3.4.0. Add it to your Gemfile.`

- Example
```
$ ruby -v ; ruby generic_main.rb
ruby 3.3.0dev (2023-08-07T23:09:02Z master 0e5da05a32) [x86_64-linux]
Fetching https://github.com/rails/rails.git
Resolving dependencies...
Fetching gem metadata from https://rubygems.org/.......
/home/yahonda/.rbenv/versions/trunk/lib/ruby/gems/3.3.0+0/bundler/gems/rails-2942958827f1/activesupport/lib/active_support/notifications/fanout.rb:3: warning: mutex_m will be not part of the default gems since Ruby 3.4.0. Add it to your Gemfile.
/home/yahonda/.rbenv/versions/trunk/lib/ruby/gems/3.3.0+0/bundler/gems/rails-2942958827f1/activesupport/lib/active_support/message_encryptor.rb:4: warning: base64 will be not part of the default gems since Ruby 3.4.0. Add it to your Gemfile.
generic_main.rb:16: warning: drb will be not part of the default gems since Ruby 3.4.0. Add it to your inline Gemfile.
$
```

- generic_main.rb
```

require "bundler/inline"

gemfile(true) do
  source "https://rubygems.org"

  git_source(:github) { |repo| "https://github.com/#{repo}.git" }

  gem "rails", github: "rails/rails", branch: "main"
end

require "active_support"
require "minitest/autorun"
require "drb"
require "base64"
require "mutex_m"
```

These gems are chosen as follows.

- Bundled gems candidates for Ruby 3.4

```ruby
$ ruby -v ; ruby -e 'pp Gem::BUNDLED_GEMS::SINCE.select { |k,v| v == "3.4.0" }'
ruby 3.3.0dev (2023-08-07T23:09:02Z master 0e5da05a32) [x86_64-linux]
{"abbrev"=>"3.4.0",
 "observer"=>"3.4.0",
 "getoptlong"=>"3.4.0",
 "resolv-replace"=>"3.4.0",
 "rinda"=>"3.4.0",
 "nkf"=>"3.4.0",
 "syslog"=>"3.4.0",
 "drb"=>"3.4.0",
 "mutex_m"=>"3.4.0",
 "csv"=>"3.4.0",
 "base64"=>"3.4.0"}
$
```

- `drb`, `mutex_m` and `base64` are required by Rails

- "drb"

```ruby
$ git grep 'require "drb"'
activesupport/lib/active_support/testing/parallelization.rb:require "drb"
activesupport/lib/active_support/testing/parallelization/server.rb:require "drb"
```

- "mutex_m"

```ruby
$ git grep 'require "mutex_m"'
actionpack/lib/action_controller/metal/params_wrapper.rb:    require "mutex_m"
activerecord/lib/active_record/attribute_methods.rb:require "mutex_m"
activerecord/lib/active_record/relation/delegation.rb:require "mutex_m"
activesupport/lib/active_support/notifications/fanout.rb:require "mutex_m"
```

- "base64" usage

```ruby
$ git grep 'require "base64"'
actioncable/Rakefile:require "base64"
actionmailer/lib/action_mailer/inline_preview_interceptor.rb:require "base64"
actionpack/lib/action_controller/metal/http_authentication.rb:require "base64"
actionview/Rakefile:require "base64"
activerecord/lib/active_record/encryption/message_serializer.rb:require "base64"
activerecord/lib/active_record/fixture_set/render_context.rb:require "base64"
activerecord/test/cases/encryption/message_serializer_test.rb:require "base64"
activesupport/lib/active_support/message_encryptor.rb:require "base64"
activesupport/lib/active_support/message_verifier.rb:require "base64"
activesupport/lib/active_support/xml_mini.rb:require "base64"
railties/test/application/mailer_previews_test.rb:require "base64"
```

- Dependency between Rails related modules

- "drb" is only required by Active Support

- "mutex_m" is required by Action Pack, Active Record and Active Support
  Action Pack and Active Record depend on Active Support. Therefore, adding dependency to Active Support is fine.

  2942958827/actionpack/actionpack.gemspec (L36)
  2942958827/activerecord/activerecord.gemspec (L38)

- "base64" is required by Action Cable, Action Mailer, Action Pack, Action View,
  Active Record, Active Support and Raillties.
  Action Cable, Action Mailer, Action Pack, Action View and Active Record and Railties depend
  on Active Support. Therefore, adding dependency to Active Support is fine.

  2942958827/actioncable/actioncable.gemspec (L35)
  2942958827/actionmailer/actionmailer.gemspec (L36)
  2942958827/actionpack/actionpack.gemspec (L36)
  2942958827/actionview/actionview.gemspec (L36)
  2942958827/actionpack/actionpack.gemspec (L36)
  2942958827/railties/railties.gemspec (L40)

Refer to:
https://bugs.ruby-lang.org/issues/19776
https://github.com/ruby/ruby/pull/8126
https://github.com/rubygems/rubygems/pull/6840
2023-08-08 21:08:48 +09:00
Rafael Mendonça França 191ae490ed
Make trilogy tests pass on MariaDB
* `supports_json?` always return false on mariadb so the test needs to
stub.
* to_a(as: :hash) is not supported on trilogy. And we should be dealing
with ActiveRecord::Result objects anyway.
2023-08-04 03:33:13 +00:00
Mike Dalessio 8a57ba8c0e
Update Action View and Dispatch to use Rails::Dom::Testing helpers
Use the helpers introduced in rails-dom-testing 2.2.0 instead of
managing the HTML parsers as was done in #48523.

See also related #47144 / ad79ed0e
2023-08-03 11:17:38 -04:00
Jean Boussier ee3117ba8a
Merge pull request #48863 from matteeyah/main
Save screenshot path on system test failure
2023-08-03 16:35:29 +02:00
Matija Čupić a962fc3c9c
Save failure screenshot path in test metadata 2023-08-03 14:43:49 +02:00
Sean Doyle 9a53234695 Omit `webdrivers` gem from `Gemfile` template
As of Selenium 4.6, [the Selenium Manager is capable of managing Chrome
Driver installations and integrations][readme]. As of Selenium 4.11, the
Selenium Manager is capable of [capable of resolving the Chrome for
Testing installation][] path.

By omitting the `gem` declaration from the `Gemfile.tt`, newly generated
applications and applications updating their `Gemfile` in lockstep with
newer Rails versions can shed the dependency and avoid test failures
introduced by newly released Chrome versions (like, for example,
[titusfortner/webdrivers#247][]).

[readme]: 43f8ac436c (update-selenium-manager)
[titusfortner/webdrivers#247]: https://github.com/titusfortner/webdrivers/issues/247
[capable of resolving the Chrome for Testing installation]: https://github.com/rails/rails/pull/48847#issuecomment-1656756862

Co-authored-by: Titus Fortner <titusfortner@users.noreply.github.com>
2023-08-01 09:22:08 -04:00
Samuel Williams 77485b0b82
Update `rack-cache` dependency. 2023-07-19 15:36:57 +12:00
Jean Boussier 5fbaa524b9 Active Record commit transaction on `return`, `break` and `throw`
Fix: https://github.com/rails/rails/issues/45017
Ref: https://github.com/rails/rails/pull/29333
Ref: https://github.com/ruby/timeout/pull/30

Historically only raised errors would trigger a rollback, but in Ruby `2.3`, the `timeout` library
started using `throw` to interupt execution which had the adverse effect of committing open transactions.

To solve this, in Active Record 6.1 the behavior was changed to instead rollback the transaction as it was safer
than to potentially commit an incomplete transaction.

Using `return`, `break` or `throw` inside a `transaction` block was essentially deprecated from Rails 6.1 onwards.

However with the release of `timeout 0.4.0`, `Timeout.timeout` now raises an error again, and Active Record is able
to return to its original, less surprising, behavior.
2023-07-10 10:37:42 +02:00