diff options
Diffstat (limited to 'activesupport/lib/active_support/testing/assertions.rb')
-rw-r--r-- | activesupport/lib/active_support/testing/assertions.rb | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/activesupport/lib/active_support/testing/assertions.rb b/activesupport/lib/active_support/testing/assertions.rb index 33793f0688..a4e0361a32 100644 --- a/activesupport/lib/active_support/testing/assertions.rb +++ b/activesupport/lib/active_support/testing/assertions.rb @@ -63,19 +63,21 @@ module ActiveSupport def assert_no_difference(expression, message = nil, &block) assert_difference expression, 0, message, &block end - + # Test if an expression is blank. Passes if object.blank? is true. # # assert_blank [] # => true - def assert_blank(object) - assert object.blank?, "#{object.inspect} is not blank" + def assert_blank(object, message=nil) + message ||= "#{object.inspect} is not blank" + assert object.blank?, message 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" + def assert_present(object, message=nil) + message ||= "#{object.inspect} is blank" + assert object.present?, message end end end |