Skip to content

Commit 97b6017

Browse files
committed
Suppress RuboCop offenses
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 ```
1 parent 07d1a8d commit 97b6017

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

test/rubocop/cop/minitest/global_expectations_test.rb

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
require_relative '../../../test_helper'
44

55
class GlobalExpectationsTest < Minitest::Test
6+
UNDERSCORE_ANY_STYLES = %i[_ any].freeze
7+
VALUE_ANY_STYLES = %i[value any].freeze
8+
EXPECT_ANY_STYLES = %i[expect any].freeze
9+
610
def setup
711
configure_enforced_style(style)
812
end
@@ -164,7 +168,7 @@ def style
164168
end
165169

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

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

212216
define_method(:"test_no_offense_when_using_expect_form_of_#{matcher}_with_expect_method") do
213-
if style == :expect || style == :any
217+
if EXPECT_ANY_STYLES.include?(style)
214218
assert_no_offenses(<<~RUBY)
215219
it 'does something' do
216220
expect(n).#{matcher} 42
@@ -325,7 +329,7 @@ def test_works_with_chained_method_calls
325329
end
326330

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

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

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

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

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

442446
define_method(:"test_no_offense_when_using_expect_form_of_#{matcher}_with_expect_method_and_block") do
443-
if style == :expect || style == :any
447+
if EXPECT_ANY_STYLES.include?(style)
444448
assert_no_offenses(<<~RUBY)
445449
it 'does something' do
446450
expect { n }.#{matcher} 42

0 commit comments

Comments
 (0)