diff options
author | Xavier Noria <fxn@hashref.com> | 2013-12-21 01:11:47 +0100 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2013-12-21 01:16:38 +0100 |
commit | 92f9ff8cc325d72d74cbf839ac9ac0acd474a768 (patch) | |
tree | 041cdcdcf7ed07f8efdd1574075f47716212fff8 /actionpack/test | |
parent | fbb79b517f3127ba620fedd01849f9628b78d6ce (diff) | |
download | rails-92f9ff8cc325d72d74cbf839ac9ac0acd474a768.tar.gz rails-92f9ff8cc325d72d74cbf839ac9ac0acd474a768.tar.bz2 rails-92f9ff8cc325d72d74cbf839ac9ac0acd474a768.zip |
converts hashes in arrays of unfiltered params to unpermitted params [fixes #13382]
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/controller/parameters/parameters_permit_test.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/actionpack/test/controller/parameters/parameters_permit_test.rb b/actionpack/test/controller/parameters/parameters_permit_test.rb index b60c5f058d..ba191a7227 100644 --- a/actionpack/test/controller/parameters/parameters_permit_test.rb +++ b/actionpack/test/controller/parameters/parameters_permit_test.rb @@ -153,6 +153,13 @@ class ParametersPermitTest < ActiveSupport::TestCase assert_equal nil, params[:foo] end + test 'hashes in array values get wrapped' do + params = ActionController::Parameters.new(foo: [{}, {}]) + params[:foo].each do |hash| + assert !hash.permitted? + end + end + test "fetch doesnt raise ParameterMissing exception if there is a default" do assert_equal "monkey", @params.fetch(:foo, "monkey") assert_equal "monkey", @params.fetch(:foo) { "monkey" } |