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.
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.
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)
```
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.
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.
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
```