Use AD.deprecator for IllegalStateError
Previously, ActionDispatch::IllegalStateError was deprecated using Module#deprecate_constant in 0b4b4c6b96a41ef649f15e1a3df26e28ef95ff24. This requires the -w flag to be used to actually see the deprecation warning, and it can not be controlled using ActiveSupport::Deprecator configuration. This commit changes the deprecation to use #deprecate_constant from ActiveSupport::Deprecation::DeprecatedConstantAccessor. This ensures that the deprecation warning will be printed even without -w, and the warning can be controlled by configuring ActionDispatch.deprecator
This commit is contained in:
parent
c8190750f9
commit
d1689ef8eb
@ -36,11 +36,14 @@ module Rack
|
||||
end
|
||||
|
||||
module ActionDispatch
|
||||
include ActiveSupport::Deprecation::DeprecatedConstantAccessor
|
||||
extend ActiveSupport::Autoload
|
||||
|
||||
class IllegalStateError < StandardError
|
||||
class DeprecatedIllegalStateError < StandardError
|
||||
end
|
||||
deprecate_constant :IllegalStateError
|
||||
deprecate_constant "IllegalStateError", "ActionDispatch::DeprecatedIllegalStateError",
|
||||
message: "ActionDispatch::IllegalStateError is deprecated without replacement.",
|
||||
deprecator: ActionDispatch.deprecator
|
||||
|
||||
class MissingController < NameError
|
||||
end
|
||||
|
@ -10,6 +10,12 @@ def setup
|
||||
@response.request = ActionDispatch::Request.empty
|
||||
end
|
||||
|
||||
def test_illegal_state_error_is_deprecated
|
||||
assert_deprecated(ActionDispatch.deprecator) do
|
||||
ActionDispatch::IllegalStateError
|
||||
end
|
||||
end
|
||||
|
||||
def test_can_wait_until_commit
|
||||
t = Thread.new {
|
||||
@response.await_commit
|
||||
|
Loading…
Reference in New Issue
Block a user