instance method
assert_not_deprecated
Ruby on Rails 7.0.10
Since v7.0.10Signature
assert_not_deprecated(deprecator = nil, &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
If no deprecator is given, defaults to ActiveSupport::Deprecation.
assert_not_deprecated do ActiveSupport::Deprecation.warn "message" # fails assertion end assert_not_deprecated do CustomDeprecator.warn "message" # passes assertion end
Parameters
-
deprecatoropt = nil -
blockblock
Source
# File activesupport/lib/active_support/testing/deprecation.rb, line 56
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
Defined in activesupport/lib/active_support/testing/deprecation.rb line 56
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveSupport::Testing::Deprecation