Skip to content

Commit

Permalink
Enable Minitest/NonExecutableTestMethod cop
Browse files Browse the repository at this point in the history
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 rails#50334 (comment)
and implemented to RuboCop Minitest 0.34.0 via rubocop/rubocop-minitest#279

This cop works as follows.
As of right now, there is no offenses by reverting the merge commit via rails#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
```
  • Loading branch information
yahonda committed Dec 17, 2023
1 parent d88f108 commit dbd4669
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
3 changes: 3 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,9 @@ Minitest/AssertWithExpectedArgument:
Minitest/LiteralAsActualArgument:
Enabled: true

Minitest/NonExecutableTestMethod:
Enabled: true

Minitest/SkipEnsure:
Enabled: true

Expand Down
18 changes: 9 additions & 9 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -438,29 +438,29 @@ GEM
retriable (3.1.2)
rexml (3.2.6)
rouge (4.2.0)
rubocop (1.57.0)
base64 (~> 0.1.1)
rubocop (1.59.0)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.2.2.4)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.28.1, < 2.0)
rubocop-ast (>= 1.30.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.29.0)
rubocop-ast (1.30.0)
parser (>= 3.2.1.0)
rubocop-md (1.2.0)
rubocop-md (1.2.2)
rubocop (>= 1.0)
rubocop-minitest (0.29.0)
rubocop-minitest (0.34.1)
rubocop (>= 1.39, < 2.0)
rubocop-ast (>= 1.30.0, < 2.0)
rubocop-packaging (0.5.2)
rubocop (>= 1.33, < 2.0)
rubocop-performance (1.16.0)
rubocop (>= 1.7.0, < 2.0)
rubocop-ast (>= 0.4.0)
rubocop-performance (1.20.0)
rubocop (>= 1.48.1, < 2.0)
rubocop-ast (>= 1.30.0, < 2.0)
rubocop-rails (2.18.0)
activesupport (>= 4.2.0)
rack (>= 1.1)
Expand Down

0 comments on commit dbd4669

Please sign in to comment.