diff options
Diffstat (limited to 'activesupport/test')
-rw-r--r-- | activesupport/test/test_test.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/activesupport/test/test_test.rb b/activesupport/test/test_test.rb index 26a45af255..dd1bc8d623 100644 --- a/activesupport/test/test_test.rb +++ b/activesupport/test/test_test.rb @@ -60,6 +60,24 @@ class AssertDifferenceTest < Test::Unit::TestCase @object.increment end end + + def test_array_of_expressions_identify_failure + assert_difference ['@object.num', '1 + 1'] do + @object.increment + end + fail 'should not get to here' + rescue Test::Unit::AssertionFailedError => e + assert_equal "<1 + 1> was expression that failed.\n<3> expected but was\n<2>.", e.message + end + + def test_array_of_expressions_identify_failure_when_message_provided + assert_difference ['@object.num', '1 + 1'], 1, 'something went wrong' do + @object.increment + end + fail 'should not get to here' + rescue Test::Unit::AssertionFailedError => e + assert_equal "something went wrong.\n<1 + 1> was expression that failed.\n<3> expected but was\n<2>.", e.message + end else def default_test; end end |