Skip to content

Commit

Permalink
Merge pull request rails#47200 from skipkayhil/use-ad-deprecator-ille…
Browse files Browse the repository at this point in the history
…gal-state

Use AD.deprecator for IllegalStateError
  • Loading branch information
eileencodes authored Jan 31, 2023
2 parents 77d4ce0 + d1689ef commit 3cca0d5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
7 changes: 5 additions & 2 deletions actionpack/lib/action_dispatch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions actionpack/test/dispatch/response_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3cca0d5

Please sign in to comment.