method
assert_deprecated
v7.0.0 -
Show latest stable
- Class:
ActiveSupport::Testing::Deprecation
assert_deprecated(match = nil, deprecator = nil, &block)public
Asserts that a matching deprecation warning was emitted by the given deprecator during the execution of the yielded block.
assert_deprecated(/foo/, CustomDeprecator) do CustomDeprecator.warn "foo should no longer be used" end
The match object may be a Regexp, or String appearing in the message.
assert_deprecated('foo', CustomDeprecator) do CustomDeprecator.warn "foo should no longer be used" end
If the match is omitted (or explicitly nil), any deprecation warning will match.
assert_deprecated(nil, CustomDeprecator) do CustomDeprecator.warn "foo should no longer be used" end
If no deprecator is given, defaults to ActiveSupport::Deprecation.
assert_deprecated do ActiveSupport::Deprecation.warn "foo should no longer be used" end