From f75addd06bbdde925d095a4d27ddd6fbdd9336ba Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Fri, 28 Dec 2012 10:34:26 -0700 Subject: Introduce assert_not to replace 'assert !foo' --- activesupport/test/test_test.rb | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'activesupport/test') 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 # ... -- cgit v1.2.3