mirror of https://github.com/rails/rails
use `message` that specified in argument to error message
This commit is contained in:
parent
b7ec47aa8f
commit
392d03a292
|
@ -159,7 +159,7 @@ module ActiveSupport
|
|||
error = "#{message}.\n#{error}" if message
|
||||
assert_not_equal before, after, error
|
||||
else
|
||||
message = "#{expression.inspect} didn't change to #{to}"
|
||||
error = "#{expression.inspect} didn't change to #{to}"
|
||||
error = "#{message}.\n#{error}" if message
|
||||
assert to === after, error
|
||||
end
|
||||
|
|
|
@ -211,6 +211,15 @@ class AssertDifferenceTest < ActiveSupport::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
def test_assert_changes_with_message
|
||||
error = assert_raises Minitest::Assertion do
|
||||
assert_changes "@object.num", "@object.num should 1", to: 1 do
|
||||
end
|
||||
end
|
||||
|
||||
assert_equal "@object.num should 1.\n\"@object.num\" didn't change to 1", error.message
|
||||
end
|
||||
|
||||
def test_assert_no_changes_pass
|
||||
assert_no_changes "@object.num" do
|
||||
# ...
|
||||
|
|
Loading…
Reference in New Issue