aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/testing
diff options
context:
space:
mode:
authorJuanjo Bazan <jjbazan@gmail.com>2010-03-30 23:39:00 +0200
committerXavier Noria <fxn@hashref.com>2010-03-30 15:25:38 -0700
commit589deb39c79cac40eec40d4ee3d86fac16c1f31f (patch)
tree112aca950139cc39ac213cb0a8ee16c8d042395b /activesupport/lib/active_support/testing
parent7212c29802e34fe7368d5b484a479c31fad49c5d (diff)
downloadrails-589deb39c79cac40eec40d4ee3d86fac16c1f31f.tar.gz
rails-589deb39c79cac40eec40d4ee3d86fac16c1f31f.tar.bz2
rails-589deb39c79cac40eec40d4ee3d86fac16c1f31f.zip
New assertion: assert_present [#4299 state:committed]
Signed-off-by: Xavier Noria <fxn@hashref.com>
Diffstat (limited to 'activesupport/lib/active_support/testing')
-rw-r--r--activesupport/lib/active_support/testing/assertions.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/testing/assertions.rb b/activesupport/lib/active_support/testing/assertions.rb
index 30a22fcc0e..e01aa80877 100644
--- a/activesupport/lib/active_support/testing/assertions.rb
+++ b/activesupport/lib/active_support/testing/assertions.rb
@@ -69,6 +69,13 @@ module ActiveSupport
def assert_blank(object)
assert object.blank?, "#{object.inspect} is not blank"
end
+
+ # Test if an expression is not blank. Passes if object.present? is true.
+ #
+ # assert_present {:data => 'x' } # => true
+ def assert_present(object)
+ assert object.present?, "#{object.inspect} is blank"
+ end
end
end
end