Skip to content

Commit

Permalink
Suppress RuboCop offenses
Browse files Browse the repository at this point in the history
This commit sppresses the following RuboCop offenses:

```console
Offenses:

test/rubocop/cop/minitest/global_expectations_test.rb:167:10: C: [Correctable] Style/MultipleComparison:
Avoid comparing a variable with multiple items in a conditional, use Array#include? instead.
      if style == :_ || style == :any
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
test/rubocop/cop/minitest/global_expectations_test.rb:190:10: C: [Correctable] Style/MultipleComparison:
Avoid comparing a variable with multiple items in a conditional, use Array#include? instead.
      if style == :value || style == :any
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
test/rubocop/cop/minitest/global_expectations_test.rb:213:10: C: [Correctable] Style/MultipleComparison:
Avoid comparing a variable with multiple items in a conditional, use Array#include? instead.
      if style == :expect || style == :any
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
test/rubocop/cop/minitest/global_expectations_test.rb:328:10: C: [Correctable] Style/MultipleComparison:
Avoid comparing a variable with multiple items in a conditional, use Array#include? instead.
      if style == :_ || style == :any
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
test/rubocop/cop/minitest/global_expectations_test.rb:351:10: C: [Correctable] Style/MultipleComparison:
Avoid comparing a variable with multiple items in a conditional, use Array#include? instead.
      if style == :_ || style == :any
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
test/rubocop/cop/minitest/global_expectations_test.rb:374:10: C: [Correctable] Style/MultipleComparison:
Avoid comparing a variable with multiple items in a conditional, use Array#include? instead.
      if style == :value || style == :any
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
test/rubocop/cop/minitest/global_expectations_test.rb:397:10: C: [Correctable] Style/MultipleComparison:
Avoid comparing a variable with multiple items in a conditional, use Array#include? instead.
      if style == :expect || style == :any
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
test/rubocop/cop/minitest/global_expectations_test.rb:420:10: C: [Correctable] Style/MultipleComparison:
Avoid comparing a variable with multiple items in a conditional, use Array#include? instead.
      if style == :value || style == :any
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
test/rubocop/cop/minitest/global_expectations_test.rb:443:10: C: [Correctable] Style/MultipleComparison:
Avoid comparing a variable with multiple items in a conditional, use Array#include? instead.
      if style == :expect || style == :any
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

137 files inspected, 9 offenses detected, 9 offenses autocorrectable
```
  • Loading branch information
koic committed Dec 27, 2024
1 parent 07d1a8d commit 97b6017
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions test/rubocop/cop/minitest/global_expectations_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
require_relative '../../../test_helper'

class GlobalExpectationsTest < Minitest::Test
UNDERSCORE_ANY_STYLES = %i[_ any].freeze
VALUE_ANY_STYLES = %i[value any].freeze
EXPECT_ANY_STYLES = %i[expect any].freeze

def setup
configure_enforced_style(style)
end
Expand Down Expand Up @@ -164,7 +168,7 @@ def style
end

define_method(:"test_no_offense_when_using_expect_form_of_#{matcher}") do
if style == :_ || style == :any
if UNDERSCORE_ANY_STYLES.include?(style)
assert_no_offenses(<<~RUBY)
it 'does something' do
_(n).#{matcher} 42
Expand All @@ -187,7 +191,7 @@ def style
end

define_method(:"test_no_offense_when_using_expect_form_of_#{matcher}_with_value_method") do
if style == :value || style == :any
if VALUE_ANY_STYLES.include?(style)
assert_no_offenses(<<~RUBY)
it 'does something' do
value(n).#{matcher} 42
Expand All @@ -210,7 +214,7 @@ def style
end

define_method(:"test_no_offense_when_using_expect_form_of_#{matcher}_with_expect_method") do
if style == :expect || style == :any
if EXPECT_ANY_STYLES.include?(style)
assert_no_offenses(<<~RUBY)
it 'does something' do
expect(n).#{matcher} 42
Expand Down Expand Up @@ -325,7 +329,7 @@ def test_works_with_chained_method_calls
end

define_method(:"test_no_offense_when_using_expect_form_of_#{matcher}") do
if style == :_ || style == :any
if UNDERSCORE_ANY_STYLES.include?(style)
assert_no_offenses(<<~RUBY)
it 'does something' do
_(n).#{matcher} 42
Expand All @@ -348,7 +352,7 @@ def test_works_with_chained_method_calls
end

define_method(:"test_no_offense_when_using_expect_form_of_#{matcher}_with_block") do
if style == :_ || style == :any
if UNDERSCORE_ANY_STYLES.include?(style)
assert_no_offenses(<<~RUBY)
it 'does something' do
_ { n }.#{matcher} 42
Expand All @@ -371,7 +375,7 @@ def test_works_with_chained_method_calls
end

define_method(:"test_no_offense_when_using_expect_form_of_#{matcher}_with_value_method") do
if style == :value || style == :any
if VALUE_ANY_STYLES.include?(style)
assert_no_offenses(<<~RUBY)
it 'does something' do
value(n).#{matcher} 42
Expand All @@ -394,7 +398,7 @@ def test_works_with_chained_method_calls
end

define_method(:"test_no_offense_when_using_expect_form_of_#{matcher}_with_expect_method") do
if style == :expect || style == :any
if EXPECT_ANY_STYLES.include?(style)
assert_no_offenses(<<~RUBY)
it 'does something' do
expect(n).#{matcher} 42
Expand All @@ -417,7 +421,7 @@ def test_works_with_chained_method_calls
end

define_method(:"test_no_offense_when_using_expect_form_of_#{matcher}_with_value_method_and_block") do
if style == :value || style == :any
if VALUE_ANY_STYLES.include?(style)
assert_no_offenses(<<~RUBY)
it 'does something' do
value { n }.#{matcher} 42
Expand All @@ -440,7 +444,7 @@ def test_works_with_chained_method_calls
end

define_method(:"test_no_offense_when_using_expect_form_of_#{matcher}_with_expect_method_and_block") do
if style == :expect || style == :any
if EXPECT_ANY_STYLES.include?(style)
assert_no_offenses(<<~RUBY)
it 'does something' do
expect { n }.#{matcher} 42
Expand Down

0 comments on commit 97b6017

Please sign in to comment.