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
```
There are assertions that expected/actual arguments are passed in the
reversed order by mistake. Enabling the LiteralAsActualArgument rule
prevents this mistake from happening.
The existing tests were auto-corrected by rubocop with a bit of
indentation adjustment.
Co-authored-by: Jonathan Hefner <jonathan@hefner.pro>
Generated using the following script and manually reviewed after:
skipkayhil/rails-bin@cbad7eddcb
The active_storage configuration had to be moved to the dummy app
because of the changed eager_load config. Now, the whole app is eagerly
loaded when the app's environment file is required which means that
changing configuration in the test_helper is too late.
Ref: ad39d6b
Ensure that all evals include file and line number to identify their
source.
Two of the evals reported by this cop were unneccesary and replaced with
non-eval alternatives: xml is set as a local variable in
Template::Handlers::Builder#call, and instance_eval isn't needed to get
the current binding.
There are additionally 27 offenses in test directories, but since it
seems less important to fix those they are currently ignored.
* Switch to a single controller option for choosing JavaScript approach
* Remove remnants of webpacker specific work within Rails
* No longer used
* Missing space
* Raise if unknown option is passed
* Style
* Use latest versions
* Make channels setup generic to all node setups
* Make Action Text installer work with any node package manager
* Explaining variables are not useless
* Rubocop pleasing
* Don't rely on Rails.root
Tests don't like it!
* Rubocopping
* Assume importmap
* No longer relevant
* Another cop
* Style
* Correct installation notice
* Add dependencies for action cable when adding a channel
* Fix paths to be relative to generator
* Just go straight to yarn, forget about binstub
* Fix tests
* Fixup installer, only yarn once
* Test generically with run
* Style
* Fix reference and reversibility
* Style
* Fix test
* Test pinning dependencies
* Remove extra space
* Add more tests
* Use latest dependencies
* Relegated this to controllers
* Refactor ChannelGenerator + more tests
Use a uniform level of abstraction
I found an unexpected use of assertion in the block of `assert_raise`
when I implemented https://github.com/rubocop/rubocop-minitest/pull/137.
It is expected to be asserted after an exception is raised in
`assert_raise` block, but in actually it is not asserted after an
exception is raised. Therefore, this PR removes or updates assertions
that have not been asserted after an exception has raised.
This PR will add `rubocop-minitest` and enable
`Minitest/UnreachableAssertion` cop to able similar auto-detection,
but will remove `rubocop-minitest` from this PR if you don't like it.
`bind_call(obj, ...)` is a faster alternative to `bind(obj).call(...)`.
https://bugs.ruby-lang.org/issues/15955
Also, enable `Performance/BindCall` cop to detect those in the future.
* Bump rubocop to 0.82
The `Layout/Tab` cop has been renamed to `Layout/IndentationStyle`
ref: https://github.com/rubocop-hq/rubocop/releases/tag/v0.82.0
No other code changes required.
* Bump rubocop-rails to 2.5.2
No code-changes required.
[Tejas Bubane + Rafael Mendonça França]