mirror of https://github.com/rails/rails
Merge pull request #47199 from skipkayhil/deprecate-missing-helper-error
Deprecate AbstractController MissingHelperError
This commit is contained in:
commit
77d4ce0ade
|
@ -1,3 +1,7 @@
|
|||
* Deprecate `AbstractController::Helpers::MissingHelperError`
|
||||
|
||||
*Hartley McGuire*
|
||||
|
||||
* Change `ActionDispatch::Testing::TestResponse#parsed_body` to parse HTML as
|
||||
a Nokogiri document
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -52,6 +52,8 @@ Please refer to the [Changelog][action-pack] for detailed changes.
|
|||
|
||||
### Deprecations
|
||||
|
||||
* Deprecate `AbstractController::Helpers::MissingHelperError`
|
||||
|
||||
* Deprecate `ActionDispatch::IllegalStateError`.
|
||||
|
||||
### Notable changes
|
||||
|
|
Loading…
Reference in New Issue