aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2015-03-28 10:01:25 +0100
committerXavier Noria <fxn@hashref.com>2015-03-28 10:01:25 +0100
commit8798788c65b0603caf4b55fe7e961e99f2ea4bde (patch)
treeeffbc275fc723a581b69cd1aec35ceb9d950277d /actionpack
parent8bf2825205ad392c923070e722fc8d39687520e3 (diff)
parent1b0526eaac87342b5413183e082b51b10a6ace6e (diff)
downloadrails-8798788c65b0603caf4b55fe7e961e99f2ea4bde.tar.gz
rails-8798788c65b0603caf4b55fe7e961e99f2ea4bde.tar.bz2
rails-8798788c65b0603caf4b55fe7e961e99f2ea4bde.zip
Merge pull request #19544 from shuhei/fix-parameters-const-missing
Return super in ActionController::Parameters.const_missing
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_controller/metal/strong_parameters.rb2
-rw-r--r--actionpack/test/controller/parameters/always_permitted_parameters_test.rb9
2 files changed, 9 insertions, 2 deletions
diff --git a/actionpack/lib/action_controller/metal/strong_parameters.rb b/actionpack/lib/action_controller/metal/strong_parameters.rb
index f19c4201ba..e30c9c5ade 100644
--- a/actionpack/lib/action_controller/metal/strong_parameters.rb
+++ b/actionpack/lib/action_controller/metal/strong_parameters.rb
@@ -117,7 +117,7 @@ module ActionController
self.always_permitted_parameters = %w( controller action )
def self.const_missing(const_name)
- super unless const_name == :NEVER_UNPERMITTED_PARAMS
+ return super unless const_name == :NEVER_UNPERMITTED_PARAMS
ActiveSupport::Deprecation.warn(<<-MSG.squish)
`ActionController::Parameters::NEVER_UNPERMITTED_PARAMS` has been deprecated.
Use `ActionController::Parameters.always_permitted_parameters` instead.
diff --git a/actionpack/test/controller/parameters/always_permitted_parameters_test.rb b/actionpack/test/controller/parameters/always_permitted_parameters_test.rb
index 059f310d49..59be08db54 100644
--- a/actionpack/test/controller/parameters/always_permitted_parameters_test.rb
+++ b/actionpack/test/controller/parameters/always_permitted_parameters_test.rb
@@ -1,5 +1,6 @@
require 'abstract_unit'
require 'action_controller/metal/strong_parameters'
+require 'minitest/mock'
class AlwaysPermittedParametersTest < ActiveSupport::TestCase
def setup
@@ -14,7 +15,13 @@ class AlwaysPermittedParametersTest < ActiveSupport::TestCase
test "shows deprecations warning on NEVER_UNPERMITTED_PARAMS" do
assert_deprecated do
- ActionController::Parameters::NEVER_UNPERMITTED_PARAMS
+ ActionController::Parameters::NEVER_UNPERMITTED_PARAMS
+ end
+ end
+
+ test "returns super on missing constant other than NEVER_UNPERMITTED_PARAMS" do
+ ActionController::Parameters.superclass.stub :const_missing, "super" do
+ assert_equal "super", ActionController::Parameters::NON_EXISTING_CONSTANT
end
end