aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2012-12-28 10:34:26 -0700
committerJeremy Kemper <jeremy@bitsweat.net>2012-12-28 10:34:26 -0700
commitf75addd06bbdde925d095a4d27ddd6fbdd9336ba (patch)
tree4fa1026c51d06d3eb57693f42c1f7e86e661bc0e /activesupport/test
parent6b18a79abe03046e5f572df26fc201958d5b2d0b (diff)
downloadrails-f75addd06bbdde925d095a4d27ddd6fbdd9336ba.tar.gz
rails-f75addd06bbdde925d095a4d27ddd6fbdd9336ba.tar.bz2
rails-f75addd06bbdde925d095a4d27ddd6fbdd9336ba.zip
Introduce assert_not to replace 'assert !foo'
Diffstat (limited to 'activesupport/test')
-rw-r--r--activesupport/test/test_test.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/activesupport/test/test_test.rb b/activesupport/test/test_test.rb
index 7f732a1d20..44fe648710 100644
--- a/activesupport/test/test_test.rb
+++ b/activesupport/test/test_test.rb
@@ -15,6 +15,27 @@ class AssertDifferenceTest < ActiveSupport::TestCase
@object.num = 0
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
+
+ begin
+ assert_not true, 'custom'
+ rescue Exception => e
+ assert_equal 'custom', e.message
+ else
+ fail 'assert_not true should fail'
+ end
+ end
+
def test_assert_no_difference
assert_no_difference '@object.num' do
# ...