module ActiveSupport::Testing::Deprecation
def assert_not_deprecated(deprecator = nil, &block)
CustomDeprecator.warn "message" # passes assertion
assert_not_deprecated do
end
ActiveSupport::Deprecation.warn "message" # fails assertion
assert_not_deprecated do
If no +deprecator+ is given, defaults to ActiveSupport::Deprecation.
end
CustomDeprecator.warn "message" # fails assertion
assert_not_deprecated(CustomDeprecator) do
Asserts that no deprecation warnings are emitted by the given deprecator during the execution of the yielded block.
def assert_not_deprecated(deprecator = nil, &block) result, deprecations = collect_deprecations(deprecator, &block) assert deprecations.empty?, "Expected no deprecation warning within the block but received #{deprecations.size}: \n #{deprecations * "\n "}" result end