aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2012-01-06 14:01:02 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2012-01-06 14:01:02 -0800
commit0579f303ec0968e66a0e17bc494b06d0996aaffd (patch)
tree8146b69c33ddb22b61269ed35a4c2e6d297b629d /activesupport/test
parentf8964bd546b925fda49aa4dc76f14acf7bf84022 (diff)
downloadrails-0579f303ec0968e66a0e17bc494b06d0996aaffd.tar.gz
rails-0579f303ec0968e66a0e17bc494b06d0996aaffd.tar.bz2
rails-0579f303ec0968e66a0e17bc494b06d0996aaffd.zip
rescue the assertion exception
Diffstat (limited to 'activesupport/test')
-rw-r--r--activesupport/test/test_test.rb21
1 files changed, 8 insertions, 13 deletions
diff --git a/activesupport/test/test_test.rb b/activesupport/test/test_test.rb
index f880052786..11506554a9 100644
--- a/activesupport/test/test_test.rb
+++ b/activesupport/test/test_test.rb
@@ -61,24 +61,19 @@ class AssertDifferenceTest < ActiveSupport::TestCase
end
def test_array_of_expressions_identify_failure
- assert_difference ['@object.num', '1 + 1'] do
- @object.increment
+ assert_raises(MiniTest::Assertion) do
+ assert_difference ['@object.num', '1 + 1'] do
+ @object.increment
+ end
end
- fail 'should not get to here'
- rescue Exception => e
- assert_match(/didn't change by/, e.message)
- assert_match(/expected but was/, 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
+ assert_raises(MiniTest::Assertion) do
+ assert_difference ['@object.num', '1 + 1'], 1, 'something went wrong' do
+ @object.increment
+ end
end
- fail 'should not get to here'
- rescue Exception => e
- assert_match(/something went wrong/, e.message)
- assert_match(/didn't change by/, e.message)
- assert_match(/expected but was/, e.message)
end
else
def default_test; end