Deprecate AbstractController MissingHelperError

This error used to be a wrapper for a LoadError raised when
require_dependency was used to load helpers for controllers.

Since Zeitwerk does not use require_dependency, the only usage of the
error was removed in 5b28a0e972.
This commit is contained in:
Hartley McGuire 2023-01-31 02:49:21 -05:00
parent c8190750f9
commit ada584bcb8
No known key found for this signature in database
GPG Key ID: E823FC1403858A82
4 changed files with 17 additions and 1 deletions

View File

@ -1,3 +1,7 @@
* Deprecate `AbstractController::Helpers::MissingHelperError`
*Hartley McGuire*
* Change `ActionDispatch::Testing::TestResponse#parsed_body` to parse HTML as
a Nokogiri document

View File

@ -5,6 +5,7 @@ require "active_support/core_ext/name_error"
module AbstractController
module Helpers
include ActiveSupport::Deprecation::DeprecatedConstantAccessor
extend ActiveSupport::Concern
included do
@ -23,7 +24,7 @@ module AbstractController
self._helpers = define_helpers_module(self)
end
class MissingHelperError < LoadError
class DeprecatedMissingHelperError < LoadError
def initialize(error, path)
@error = error
@path = "helpers/#{path}.rb"
@ -36,6 +37,9 @@ module AbstractController
end
end
end
deprecate_constant "MissingHelperError", "AbstractController::Helpers::DeprecatedMissingHelperError",
message: "AbstractController::Helpers::MissingHelperError has been deprecated. If a Helper is not present, a NameError will be raised instead.",
deprecator: AbstractController.deprecator
def _helpers
self.class._helpers

View File

@ -264,6 +264,12 @@ class HelperTest < ActiveSupport::TestCase
assert_equal "smth", AllHelpersController.helpers.config.my_var
end
def test_missing_helper_error_is_deprecated
assert_deprecated(AbstractController.deprecator) do
AbstractController::Helpers::MissingHelperError
end
end
private
def expected_helper_methods
TestHelper.instance_methods

View File

@ -52,6 +52,8 @@ Please refer to the [Changelog][action-pack] for detailed changes.
### Deprecations
* Deprecate `AbstractController::Helpers::MissingHelperError`
* Deprecate `ActionDispatch::IllegalStateError`.
### Notable changes