diff options
author | Akshay Vishnoi <akshay.vishnoi@vinsol.com> | 2014-06-13 06:52:58 +0530 |
---|---|---|
committer | Akshay Vishnoi <akshay.vishnoi@vinsol.com> | 2014-06-13 06:52:58 +0530 |
commit | bb5c1321d6eb97e08bd6cf134ae381410b8a6281 (patch) | |
tree | f2ad1beca3f5719bc6d8164f09ec6c064286fed0 /activesupport | |
parent | caf1bfccc680510b48e058d40c2a99cae965b5cb (diff) | |
download | rails-bb5c1321d6eb97e08bd6cf134ae381410b8a6281.tar.gz rails-bb5c1321d6eb97e08bd6cf134ae381410b8a6281.tar.bz2 rails-bb5c1321d6eb97e08bd6cf134ae381410b8a6281.zip |
Add missing test cases for #assert_no_difference
Diffstat (limited to 'activesupport')
-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 |