aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKasper Timm Hansen <kaspth@gmail.com>2016-08-29 08:13:55 +0200
committerGitHub <noreply@github.com>2016-08-29 08:13:55 +0200
commiteab8c3b9c2b729fa0ba98ff21ad9f635a8391e87 (patch)
tree061e033c7595562cbe40cacf647614e5c529f16f
parent8d251029cefaad559fb92c3ac529c6d490e4d280 (diff)
parent6582c7c54a4be7275ea9df5c787d8e686f74b618 (diff)
downloadrails-eab8c3b9c2b729fa0ba98ff21ad9f635a8391e87.tar.gz
rails-eab8c3b9c2b729fa0ba98ff21ad9f635a8391e87.tar.bz2
rails-eab8c3b9c2b729fa0ba98ff21ad9f635a8391e87.zip
Merge pull request #26311 from y-yagi/use_inspect_for_show_value
use `inspect` for show `from` value
-rw-r--r--activesupport/lib/active_support/testing/assertions.rb2
-rw-r--r--activesupport/test/test_case_test.rb9
2 files changed, 10 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/testing/assertions.rb b/activesupport/lib/active_support/testing/assertions.rb
index 6a6941c72a..8c9ea2c0e8 100644
--- a/activesupport/lib/active_support/testing/assertions.rb
+++ b/activesupport/lib/active_support/testing/assertions.rb
@@ -147,7 +147,7 @@ module ActiveSupport
retval = yield
unless from == UNTRACKED
- error = "#{expression.inspect} isn't #{from}"
+ error = "#{expression.inspect} isn't #{from.inspect}"
error = "#{message}.\n#{error}" if message
assert from === before, error
end
diff --git a/activesupport/test/test_case_test.rb b/activesupport/test/test_case_test.rb
index d3d2ed8d7a..dfbb8aa41d 100644
--- a/activesupport/test/test_case_test.rb
+++ b/activesupport/test/test_case_test.rb
@@ -138,6 +138,15 @@ class AssertDifferenceTest < ActiveSupport::TestCase
end
end
+ def test_assert_changes_with_from_option_with_nil
+ error = assert_raises Minitest::Assertion do
+ assert_changes "@object.num", from: nil do
+ @object.increment
+ end
+ end
+ assert_equal "\"@object.num\" isn't nil", error.message
+ end
+
def test_assert_changes_with_to_option
assert_changes "@object.num", to: 1 do
@object.increment