diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2017-04-11 22:00:14 -0400 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2017-04-18 17:33:24 -0400 |
commit | e13e72cce4e08484aaa03b1e62fc0c70d0a7e6f9 (patch) | |
tree | a78a8b3337ef51bd6eb82c80bb34a2e82285b073 /actionpack/test/controller/parameters | |
parent | 9f4c2632ef28b9622ffa0eca5d02beea8ec809c0 (diff) | |
download | rails-e13e72cce4e08484aaa03b1e62fc0c70d0a7e6f9.tar.gz rails-e13e72cce4e08484aaa03b1e62fc0c70d0a7e6f9.tar.bz2 rails-e13e72cce4e08484aaa03b1e62fc0c70d0a7e6f9.zip |
Add test to make sure that to_unsafe_h don't mutate the target
Diffstat (limited to 'actionpack/test/controller/parameters')
-rw-r--r-- | actionpack/test/controller/parameters/parameters_permit_test.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/actionpack/test/controller/parameters/parameters_permit_test.rb b/actionpack/test/controller/parameters/parameters_permit_test.rb index 12555c3136..6d41d4fc64 100644 --- a/actionpack/test/controller/parameters/parameters_permit_test.rb +++ b/actionpack/test/controller/parameters/parameters_permit_test.rb @@ -443,6 +443,16 @@ class ParametersPermitTest < ActiveSupport::TestCase assert_equal expected, params.to_unsafe_h end + test "to_unsafe_h does not mutate the parameters" do + params = ActionController::Parameters.new("f" => { "language_facet" => ["Tibetan"] }) + params[:f] + + params.to_unsafe_h + + assert_not_predicate params, :permitted? + assert_not_predicate params[:f], :permitted? + end + test "to_h only deep dups Ruby collections" do company = Class.new do attr_reader :dupped |