aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/parameters
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2013-12-21 14:22:08 +0100
committerXavier Noria <fxn@hashref.com>2013-12-21 14:22:08 +0100
commit273045d6d5c5f68e38f917e8ab4b1ad533d23aac (patch)
tree4b92a4692d1d244bb902fa17c4f503b62552615f /actionpack/test/controller/parameters
parent269424b0bb8c103418d8a948bf88ca708350ebff (diff)
downloadrails-273045d6d5c5f68e38f917e8ab4b1ad533d23aac.tar.gz
rails-273045d6d5c5f68e38f917e8ab4b1ad533d23aac.tar.bz2
rails-273045d6d5c5f68e38f917e8ab4b1ad533d23aac.zip
optimizes array conversion in AC::Parameters
Diffstat (limited to 'actionpack/test/controller/parameters')
-rw-r--r--actionpack/test/controller/parameters/parameters_permit_test.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/actionpack/test/controller/parameters/parameters_permit_test.rb b/actionpack/test/controller/parameters/parameters_permit_test.rb
index ba191a7227..9c1828e9aa 100644
--- a/actionpack/test/controller/parameters/parameters_permit_test.rb
+++ b/actionpack/test/controller/parameters/parameters_permit_test.rb
@@ -160,6 +160,11 @@ class ParametersPermitTest < ActiveSupport::TestCase
end
end
+ test 'arrays are converted at most once' do
+ params = ActionController::Parameters.new(foo: [{}])
+ assert params[:foo].equal?(params[:foo])
+ 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" }