Commit Graph

90378 Commits

Author SHA1 Message Date
Junichi Sato c143ce7fa1
Get rid of EnvHelpers at Minitest::RailsPluginTest
In https://github.com/rails/rails/pull/50563 the test case which requires
EnvHelpers has moved to a separate file. Consequently this file no longer
needs to include nor require EnvHelpers.
2024-01-04 11:32:33 +09:00
Junichi Sato 994aeacddf
`#render_template_to_object` and `#render_partial_to_object` are private
Apparently it had not been clear what visibility they should assume
when they were initially created at https://github.com/rails/rails/pull/35265,
then a big refactoring took place at https://github.com/rails/rails/pull/38594
after which they remain intact.

So I think they can now become properly private as they are nodoc and
not refered to but from within the same class.
2024-01-04 10:50:08 +09:00
Jonathan Hefner bc21ccf64b Fix class name for backtrace_cleaner_test.rb
Follow-up to #50563.
2024-01-03 18:27:55 -06:00
Jonathan Hefner c2e2a1d39f
Merge pull request #50569 from jonathanhefner/follow-up-50050
Handle all false args in `config.x` error check
2024-01-03 17:32:16 -06:00
Jonathan Hefner e39373c0b0 Fix JavaScript code fence and syntax [ci-skip]
Follow-up to #49857.
2024-01-03 17:10:20 -06:00
Jonathan Hefner 4bbcedaa15
Merge pull request #50564 from jonathanhefner/follow-up-50545
Use logical core count for test parallelization
2024-01-03 17:08:09 -06:00
Jonathan Hefner 2736acec66 Handle all false args in config.x error check
Follow-up to #50050.

Using `args.none?` does not catch the case when all args are `false` or
`nil`.  Therefore, this commit changes the condition to `args.empty?`.

This commit also changes the error message to more closely match Ruby's
error messages when trying to pass an arg to a getter method:

  ```ruby
  Rails.configuration.x(false)
  # => wrong number of arguments (given 1, expected 0) (ArgumentError)

  Rails.configuration.x.i_do_not_exist(false)
  # => wrong number of arguments (given 1, expected 0) when reading configuration `i_do_not_exist` (ArgumentError)
  ```
2024-01-03 16:59:02 -06:00
fatkodima e5a724ad41
Merge pull request #50438 from fatkodima/schema_dump-docs
Add `schema_dump` docs to the multiple databases docs [skip ci]
2024-01-04 00:58:22 +02:00
fatkodima c4cad767f5
Merge pull request #50439 from fatkodima/migrations_paths-for-replicas
Remove setting `migrations_paths` for replicas from the docs [skip ci]
2024-01-04 00:57:46 +02:00
Rafael Mendonça França 1c3ae8719f
Merge pull request #50563 from ghiculescu/configure_backtrace_cleaner
Add `BACKTRACE` env variable to turn off backtrace
2024-01-03 17:14:21 -05:00
Jonathan Hefner 65087c8382 Use logical core count for test parallelization
This changes the default number of workers when parallelizing tests to
be based on logical core count instead of physical core count.  This may
provide a performance boost for parallelized tests.

This also reverts #50545 in favor of using the default worker count.
2024-01-03 16:13:47 -06:00
Alex Ghiculescu 957a3e5e55 Add BACKTRACE env variable to turn off backtrace for normal running, not just tests 2024-01-04 07:25:12 +10:00
Rafael Mendonça França 0d940e376c
Don't run rubocop after generation on Ruby 3.4+ 2024-01-03 21:16:19 +00:00
Rafael Mendonça França c11ad35783
Remove `apply_rubocop_autocorrect_after_generate!` from `development.rb` in `build_app`
This will fix tests for versions of Ruby that Rubocop doesn't
have a parser for.
2024-01-03 21:16:18 +00:00
Rafael Mendonça França 44bc952591
Merge pull request #50050 from seanpdoyle/config-x-read-with-arguments-no-method
Raise `ArgumentError` when reading from `config.x` with arguments
2024-01-03 15:50:57 -05:00
Rafael Mendonça França bfac3fc6a3
Merge pull request #47939 from sirwolfgang/bugfix-actioncable
[Fix: 47938] self is undefined for actioncable
2024-01-03 15:14:16 -05:00
Sean Doyle 9a58f7eccd Raise `ArgumentError` when reading from `config.x` with arguments
The flexibility provided by `config.x` supports arbitrarily defining new
configuration objects on-the-fly. Each new intermediate configuration
object is constructed during chaining from its ancestor through a method
invocation made without arguments.

Conversely, writing to leaf configuration values occurs when the invoked
method's name ends with `=`, and the new configuration value is assigned
to whatever that method's arguments are.

There are no cases when reading from a `config.x` value or building the
intermediate values involves arguments.

Prior to this commit, a read invoked with a method arguments would
ignore those arguments. While this is robust and error-free, it's
possible to obscure misuse.

For example, consider a line like:

```ruby
config.x.my_config.enabled = true
config.x.my_config.enabled #=> true
```

Now consider that first line with a typo that omits the `=`:

```ruby
config.x.my_config.enabled true
config.x.my_config.enabled #=> nil
```

This commit aims to provide more direct feedback for scenarios like the
one above. There aren't legitimate use cases for invoking `#enabled`
with arguments, so raise a `ArgumentError` when encountering a read with
arguments.
2024-01-03 15:08:40 -05:00
Rafael Mendonça França b1fd934bbc
Merge pull request #46238 from austenmadden/resolve-validates-associated-ignores-contexts
Pass validation_context to validates_associated
2024-01-03 14:44:54 -05:00
Zane Wolfgang Pickett f634121c3d
Fix self is undefined for actioncable within ssr build systems by replacing it globalThis 2024-01-03 19:19:50 +00:00
Rafael Mendonça França 4646b0036b
Merge pull request #50181 from akhilgkrishnan/add-codehighlight
Add markdown code highlight for bash script [skip ci]
2024-01-03 14:17:34 -05:00
Rafael Mendonça França 8b4e92f4be
Point rubocop to ruby 3.1 2024-01-03 19:02:32 +00:00
Rafael Mendonça França 9d18dc8505
Remove all code to work with Ruby < 3.1 2024-01-03 19:02:31 +00:00
Akhil G Krishnan abf5ce1aa7 Add markdown codehighlight for bash script
Removed unwanted changes
2024-01-04 00:30:50 +05:30
Rafael Mendonça França dc581c0cc7
Merge pull request #50171 from akhilgkrishnan/add-link-to-api-documentation
Add link to API documentation for ActionView helper method [skip ci]
2024-01-03 13:41:49 -05:00
Akhil G Krishnan e61c4b353d Add link to API documentation for ActionView helper method 2024-01-03 23:36:10 +05:30
Rafael Mendonça França 664eb0dfc4
Merge pull request #50473 from seanpdoyle/action-text-content-pattern-matching
Delegate `ActionText::Content#deconstruct` to Nokogiri
2024-01-03 12:31:22 -05:00
Rafael Mendonça França 16388f6bc1
Merge pull request #50379 from yahonda/enable_minitest_non_executable_test_method_cop
Enable `Minitest/NonExecutableTestMethod` cop
2024-01-03 12:17:50 -05:00
Rafael Mendonça França 0b3cafe4af
Merge pull request #49857 from mguan2020/ujsfix
Documented a breaking change regarding imports in @rails/ujs 7.1.0 [ci skip]
2024-01-03 12:17:18 -05:00
Rafael Mendonça França ed0455665a
Update guides/source/upgrading_ruby_on_rails.md
Co-authored-by: zzak <zzakscott@gmail.com>
2024-01-03 12:12:40 -05:00
Rafael Mendonça França 2416cc162d
Merge pull request #50555 from akhilgkrishnan/add-removal-of-ujs-in-release-note
Document removal of rails/ujs in release note [skip ci]
2024-01-03 12:11:00 -05:00
Rafael Mendonça França b52bd2149a
Merge pull request #50547 from faqndo97/run_importmap_audit_on_ci
Run importmap audit on CI
2024-01-03 12:08:24 -05:00
Rafael Mendonça França 588843cea1
Merge pull request #50545 from santib/use-all-ci-cores
Parallelize tests in the CI
2024-01-03 12:06:33 -05:00
Yasuo Honda 6384eec00f
Enable `Minitest/NonExecutableTestMethod` cop
This pull request enables `Minitest/NonExecutableTestMethod` cop
to find non-executed test that is out of `ActiveSupport::TestCase` and its subclasses.

This cop is based on the request since there was a test that is not executed found
at https://github.com/rails/rails/pull/50334#issuecomment-1851411434
and implemented to RuboCop Minitest 0.34.0 via https://github.com/rubocop/rubocop-minitest/issues/279

This cop works as follows.
As of right now, there is no offenses by reverting the merge commit via #50334

```
$ git revert -m 1 9517841
$ bundle exec rubocop
Inspecting 3254 files
... snip ...

Offenses:

activerecord/test/cases/assertions/query_assertions_test.rb:27:5: W: Minitest/NonExecutableTestMethod: Test method should be defined inside a test class to ensure execution.
    def test_assert_no_queries ...
    ^^^^^^^^^^^^^^^^^^^^^^^^^^

3254 files inspected, 1 offense detected
$
```

* `Gemfile.lock` has been updated as follows
```
bundle update rubocop rubocop-minitest --conservative
```
2024-01-03 17:04:25 +00:00
Rafael Mendonça França aadecbeb01
Merge pull request #50541 from bparanj/document-edge-cases-for-find
Document edge cases for find
2024-01-03 11:56:04 -05:00
Rafael Mendonça França b0b1eb5a18
Eager load the Rails default controllers used in production (#50558)
Since those controller can be used in production we need to eager load
them to better copy-on-write and avoid tread-safety issues.
2024-01-03 11:44:09 -05:00
Rafael Mendonça França 826a3d1545
Merge pull request #50543 from santib/run-ci-on-every-pr
Adjust CI config for new Rails apps to run on PRs to any branch
2024-01-03 11:12:42 -05:00
fatkodima 3c7b520656
Merge pull request #50554 from akhilgkrishnan/document-github-ci
Add .github to the default rails file structure [skip ci]
2024-01-03 15:42:48 +02:00
Akhil G Krishnan 27efabe89e Document removal of rails/ujs in release note 2024-01-03 19:10:52 +05:30
Akhil G Krishnan bf0f8846a7 Add .github to the default rails file structure
requested changes updated
2024-01-03 18:51:30 +05:30
David Heinemeier Hansson bb5e2791e0
Add default pwa manifest and service worker file (#50528)
* Add default pwa manifest and service worker file

* Update CHANGELOG.md
2024-01-03 13:07:12 +01:00
Petrik de Heus 1ea796d6a8
Merge pull request #50523 from bparanj/correct-usage-of-named-routes
Document correct usage of named routes [skip ci]
2024-01-03 08:16:09 +01:00
Bala Paranj 74ad7356e2 Document correct usage of named routes [skip ci] 2024-01-02 21:27:54 -05:00
Facundo Espinosa 44ee8b17a2 Run importmap audit on CI 2024-01-02 22:17:14 -03:00
Santiago Bartesaghi 1266d8992b Parallelize tests in the CI 2024-01-02 19:27:47 -03:00
Bala Paranj ad9a4c2f03 Document edge cases for ActiveRecord find method [skip ci] 2024-01-02 17:02:22 -05:00
Santiago Bartesaghi 05ce89417d Adjust CI config to run on PRs to any branch 2024-01-02 18:57:00 -03:00
Rafael Mendonça França 1e4f161084
Merge pull request #50538 from sato11/rescue-responses-docs
Resolve documentational ambiguity over `rescue_responses` [ci-skip]
2024-01-02 15:15:53 -05:00
Rafael Mendonça França 6c0f5f65a7
Merge pull request #50540 from santib/dependabot-add-gha
Make dependabot also check for outdated GHA actions
2024-01-02 14:48:40 -05:00
Santiago Bartesaghi aa13b5107e Add GHA actions to dependabot 2024-01-02 15:35:19 -03:00
Lázaro Nixon 42ca4de429
User content_for for titles in the application layout (#49702) 2024-01-02 17:39:35 +01:00