Skip to content

Commit

Permalink
Remove redundant parentheses tests
Browse files Browse the repository at this point in the history
rubocop/rubocop#11739 updated `Style/RedundantParentheses` to detect
this, so we can now consider it out of scope of these cops, as was done
in https://github.com/rubocop/rubocop-minitest/pull/248/files#r1150046949.
  • Loading branch information
sambostock committed Oct 20, 2023
1 parent 5d7a349 commit 05a75d0
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 38 deletions.
19 changes: 0 additions & 19 deletions test/rubocop/cop/minitest/assert_respond_to_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,25 +85,6 @@ def test_do_something
RUBY
end

def test_registers_offense_when_using_assert_with_respond_to_in_redundant_parentheses
assert_offense(<<~RUBY)
class FooTest < Minitest::Test
def test_do_something
assert((object.respond_to?(:do_something)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Prefer using `assert_respond_to(object, :do_something)`.
end
end
RUBY

assert_correction(<<~RUBY)
class FooTest < Minitest::Test
def test_do_something
assert_respond_to((object, :do_something))
end
end
RUBY
end

def test_does_not_register_offense_when_using_assert_respond_to
assert_no_offenses(<<~RUBY)
class FooTest < Minitest::Test
Expand Down
19 changes: 0 additions & 19 deletions test/rubocop/cop/minitest/refute_respond_to_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,25 +85,6 @@ def test_do_something
RUBY
end

def test_registers_offense_when_using_refute_with_respond_to_in_redundant_parentheses
assert_offense(<<~RUBY)
class FooTest < Minitest::Test
def test_do_something
refute((object.respond_to?(:do_something)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Prefer using `refute_respond_to(object, :do_something)`.
end
end
RUBY

assert_correction(<<~RUBY)
class FooTest < Minitest::Test
def test_do_something
refute_respond_to((object, :do_something))
end
end
RUBY
end

def test_does_not_register_offense_when_using_assert_respond_to
assert_no_offenses(<<~RUBY)
class FooTest < Minitest::Test
Expand Down

0 comments on commit 05a75d0

Please sign in to comment.