diff options
Diffstat (limited to 'activesupport/test/test_case_test.rb')
-rw-r--r-- | activesupport/test/test_case_test.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/activesupport/test/test_case_test.rb b/activesupport/test/test_case_test.rb index 19901fad99..8698c66e6d 100644 --- a/activesupport/test/test_case_test.rb +++ b/activesupport/test/test_case_test.rb @@ -52,6 +52,22 @@ class AssertionsTest < ActiveSupport::TestCase assert_equal "Object Changed.\n\"@object.num\" didn't change by 0.\nExpected: 0\n Actual: 1", error.message end + def test_assert_no_difference_with_multiple_expressions_pass + another_object = @object.dup + assert_no_difference ["@object.num", -> { another_object.num }] do + # ... + end + end + + def test_assert_no_difference_with_multiple_expressions_fail + another_object = @object.dup + assert_raises(Minitest::Assertion) do + assert_no_difference ["@object.num", -> { another_object.num }], "Another Object Changed" do + another_object.increment + end + end + end + def test_assert_difference assert_difference "@object.num", +1 do @object.increment |