From 589deb39c79cac40eec40d4ee3d86fac16c1f31f Mon Sep 17 00:00:00 2001 From: Juanjo Bazan Date: Tue, 30 Mar 2010 23:39:00 +0200 Subject: New assertion: assert_present [#4299 state:committed] Signed-off-by: Xavier Noria --- activesupport/lib/active_support/testing/assertions.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'activesupport/lib/active_support/testing') 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 -- cgit v1.2.3