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(CustomDeprecator) do
  CustomDeprecator.warn "foo should no longer be used"
end
Show source
Register or log in to add new notes.