diff --git a/actionpack/lib/action_dispatch.rb b/actionpack/lib/action_dispatch.rb index 8faa514986..cde4d6cb80 100644 --- a/actionpack/lib/action_dispatch.rb +++ b/actionpack/lib/action_dispatch.rb @@ -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 diff --git a/actionpack/test/dispatch/response_test.rb b/actionpack/test/dispatch/response_test.rb index 580495be38..940e3d4164 100644 --- a/actionpack/test/dispatch/response_test.rb +++ b/actionpack/test/dispatch/response_test.rb @@ -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