diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2012-12-28 21:47:42 -0700 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2012-12-28 21:47:42 -0700 |
commit | 8a130ece7e265f1e94abef8d64d5c6880797e831 (patch) | |
tree | 09d7a3923ce465d7b3dcc5158c457bbaaf6677e9 /activesupport/test | |
parent | 54a65183e706d324fd220b5ff46c9a8dc27bfe89 (diff) | |
download | rails-8a130ece7e265f1e94abef8d64d5c6880797e831.tar.gz rails-8a130ece7e265f1e94abef8d64d5c6880797e831.tar.bz2 rails-8a130ece7e265f1e94abef8d64d5c6880797e831.zip |
Test that assert_not returns true. Use assert_raises instead of doing begin/rescue/else.
Diffstat (limited to 'activesupport/test')
-rw-r--r-- | activesupport/test/test_test.rb | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/activesupport/test/test_test.rb b/activesupport/test/test_test.rb index 44fe648710..0f93c8b59e 100644 --- a/activesupport/test/test_test.rb +++ b/activesupport/test/test_test.rb @@ -16,24 +16,14 @@ class AssertDifferenceTest < ActiveSupport::TestCase end def test_assert_not - assert_not nil - assert_not false - - begin - assert_not true - rescue Exception => e - assert_equal 'Expected true to be nil or false', e.message - else - fail 'assert_not true should fail' - end + assert_equal true, assert_not(nil) + assert_equal true, assert_not(false) - begin - assert_not true, 'custom' - rescue Exception => e - assert_equal 'custom', e.message - else - fail 'assert_not true should fail' - end + e = assert_raises(MiniTest::Assertion) { assert_not true } + assert_equal 'Expected true to be nil or false', e.message + + e = assert_raises(MiniTest::Assertion) { assert_not true, 'custom' } + assert_equal 'custom', e.message end def test_assert_no_difference |