Skip to content

Commit

Permalink
fixup! [Fix #117] Add new Minitest/AssertWithTwoArguments cop
Browse files Browse the repository at this point in the history
  • Loading branch information
cstyles committed Feb 21, 2021
1 parent 6917350 commit 912fd40
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion test/rubocop/cop/minitest/assert_with_two_arguments_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def test_do_something
RUBY
end

def test_does_not_register_offense_when_second_argument_is_a_string
def test_does_not_register_offense_when_second_argument_is_a_literal_string
assert_no_offenses(<<~RUBY)
class FooTest < Minitest::Test
def test_do_something
Expand All @@ -34,4 +34,25 @@ def test_do_something
end
RUBY
end

def test_does_not_register_offense_when_second_argument_is_an_interpolated_string
assert_no_offenses(<<~'RUBY')
class FooTest < Minitest::Test
def test_do_something
additional_message = 'hello world'
assert([], "empty array should be truthy #{additional_message}")
end
end
RUBY
end

def test_does_not_register_offense_when_using_assert_equal_with_two_arguments
assert_no_offenses(<<~'RUBY')
class FooTest < Minitest::Test
def test_do_something
assert_equal(3, actual)
end
end
RUBY
end
end

0 comments on commit 912fd40

Please sign in to comment.