diff options
author | Guillermo Iguaran <guilleiguaran@gmail.com> | 2012-08-30 16:36:59 -0500 |
---|---|---|
committer | Guillermo Iguaran <guilleiguaran@gmail.com> | 2012-09-16 23:58:21 -0500 |
commit | 1aaf4490b29afc99cf19b18c4edbb1f28e6c37f5 (patch) | |
tree | 5901dbcaf12030a473edb6f463e8e4af9fe6391a /actionpack/test/controller | |
parent | 1e1bee3ab985e47fae49d9fd5d2ca946f5d9c533 (diff) | |
download | rails-1aaf4490b29afc99cf19b18c4edbb1f28e6c37f5.tar.gz rails-1aaf4490b29afc99cf19b18c4edbb1f28e6c37f5.tar.bz2 rails-1aaf4490b29afc99cf19b18c4edbb1f28e6c37f5.zip |
Add config.action_controller.permit_all_attributes to bypass StrongParameters protection
Diffstat (limited to 'actionpack/test/controller')
-rw-r--r-- | actionpack/test/controller/parameters/parameters_permit_test.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/actionpack/test/controller/parameters/parameters_permit_test.rb b/actionpack/test/controller/parameters/parameters_permit_test.rb index f143e22d2e..7fe8e6051b 100644 --- a/actionpack/test/controller/parameters/parameters_permit_test.rb +++ b/actionpack/test/controller/parameters/parameters_permit_test.rb @@ -56,4 +56,18 @@ class ParametersPermitTest < ActiveSupport::TestCase @params.permit! assert_equal @params.permitted?, @params.dup.permitted? end + + test "permitted takes a default value when Parameters.permit_all_parameters is set" do + begin + ActionController::Parameters.permit_all_parameters = true + params = ActionController::Parameters.new({ person: { + age: "32", name: { first: "David", last: "Heinemeier Hansson" } + }}) + + assert params.slice(:person).permitted? + assert params[:person][:name].permitted? + ensure + ActionController::Parameters.permit_all_parameters = false + end + end end |