Module: ActiveSupport::Deprecation::Assertions

Included in:
Test::Unit::TestCase
Defined in:
lib/monetra/active_support/deprecation.rb

Instance Method Summary collapse

Instance Method Details

#assert_deprecated(match = nil, &block) ⇒ Object



51
52
53
54
55
56
# File 'lib/monetra/active_support/deprecation.rb', line 51

def assert_deprecated(match = nil, &block)
  last = with_last_message_tracking_deprecation_behavior(&block)
  assert last, "Expected a deprecation warning within the block but received none"
  match = Regexp.new(Regexp.escape(match)) unless match.is_a?(Regexp)
  assert_match match, last, "Deprecation warning didn't match #{match}: #{last}"
end

#assert_not_deprecated(&block) ⇒ Object



58
59
60
61
# File 'lib/monetra/active_support/deprecation.rb', line 58

def assert_not_deprecated(&block)
  last = with_last_message_tracking_deprecation_behavior(&block)
  assert_nil last, "Expected no deprecation warning within the block but received one: #{last}"
end