Skip to content

Commit

Permalink
Use assert_match instead of assert_equal to test the error message. (…
Browse files Browse the repository at this point in the history
…mame)

[git-p4: depot-paths = "//src/minitest/dev/": change = 13271]
  • Loading branch information
zenspider committed Dec 5, 2021
1 parent f4f57af commit 9703495
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions test/minitest/test_minitest_mock.rb
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def test_expect_with_non_array_args
@mock.expect :blah, 3, false
end

assert_equal "args must be an array", e.message
assert_match "args must be an array", e.message
end

def test_respond_appropriately
Expand All @@ -150,7 +150,7 @@ def test_no_method_error_on_unexpected_methods

expected = "unmocked method :bar, expected one of [:foo, :meaning_of_life]"

assert_equal expected, e.message
assert_match expected, e.message
end

def test_assign_per_mock_return_values
Expand Down Expand Up @@ -309,7 +309,7 @@ def test_mock_block_throws_if_args_passed

exp = "args ignored when block given"

assert_equal exp, e.message
assert_match exp, e.message
end

def test_mock_returns_retval_when_called_with_block
Expand Down Expand Up @@ -822,7 +822,7 @@ def test_stub_value_block_args_5__break_if_not_passed
end
end
exp = "undefined method `write' for nil:NilClass"
assert_equal exp, e.message
assert_match exp, e.message
end

def test_stub_value_block_args_6
Expand Down

0 comments on commit 9703495

Please sign in to comment.