From 6384eec00f167ee25c3822997ff673541d051387 Mon Sep 17 00:00:00 2001 From: Yasuo Honda Date: Sun, 17 Dec 2023 15:13:23 +0900 Subject: [PATCH] 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 ``` --- .rubocop.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.rubocop.yml b/.rubocop.yml index d78d8ff473f94..59d0c38bf6fe1 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -367,6 +367,9 @@ Minitest/AssertWithExpectedArgument: Minitest/LiteralAsActualArgument: Enabled: true +Minitest/NonExecutableTestMethod: + Enabled: true + Minitest/SkipEnsure: Enabled: true