diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-06-13 18:40:29 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-06-13 18:40:29 -0300 |
commit | bcb0b99fe94d7f8ad5404cb0d90b9348a68e1d23 (patch) | |
tree | 6a023037d42a03e476b22664742debf2acd4398a | |
parent | 4c0a1021e51bfb8f3623480f577f7f52d83a0fc7 (diff) | |
parent | bb5c1321d6eb97e08bd6cf134ae381410b8a6281 (diff) | |
download | rails-bcb0b99fe94d7f8ad5404cb0d90b9348a68e1d23.tar.gz rails-bcb0b99fe94d7f8ad5404cb0d90b9348a68e1d23.tar.bz2 rails-bcb0b99fe94d7f8ad5404cb0d90b9348a68e1d23.zip |
Merge pull request #15679 from akshay-vishnoi/test-cases
Add missing test cases for #assert_no_difference
-rw-r--r-- | activesupport/test/test_test.rb | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/activesupport/test/test_test.rb b/activesupport/test/test_test.rb index 0fa08c0e3a..6f63a8a725 100644 --- a/activesupport/test/test_test.rb +++ b/activesupport/test/test_test.rb @@ -28,12 +28,30 @@ class AssertDifferenceTest < ActiveSupport::TestCase assert_equal 'custom', e.message end - def test_assert_no_difference + def test_assert_no_difference_pass assert_no_difference '@object.num' do # ... end end + def test_assert_no_difference_fail + error = assert_raises(Minitest::Assertion) do + assert_no_difference '@object.num' do + @object.increment + end + end + assert_equal "\"@object.num\" didn't change by 0.\nExpected: 0\n Actual: 1", error.message + end + + def test_assert_no_difference_with_message_fail + error = assert_raises(Minitest::Assertion) do + assert_no_difference '@object.num', 'Object Changed' do + @object.increment + end + end + assert_equal "Object Changed.\n\"@object.num\" didn't change by 0.\nExpected: 0\n Actual: 1", error.message + end + def test_assert_difference assert_difference '@object.num', +1 do @object.increment |