instance method
assert_not_deprecated
Ruby on Rails 8.1.2
Since v7.0.10Signature
assert_not_deprecated(deprecator, &block)
Asserts that no deprecation warnings are emitted by the given deprecator during the execution of the yielded block.
assert_not_deprecated(CustomDeprecator) do CustomDeprecator.warn "message" # fails assertion end assert_not_deprecated(ActiveSupport::Deprecation.new) do CustomDeprecator.warn "message" # passes assertion, different deprecator end
Parameters
-
deprecatorreq -
blockblock
Source
# File activesupport/lib/active_support/testing/deprecation.rb, line 55
def assert_not_deprecated(deprecator, &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
Defined in activesupport/lib/active_support/testing/deprecation.rb line 55
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveSupport::Testing::Deprecation