diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-10-18 00:31:46 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-10-18 00:31:46 -0300 |
commit | 0c3ca0f013904d40bf11ac9da95ed0ef3d9ddc86 (patch) | |
tree | 62346b5c610961d6353239123196f169b7e48fda /actionpack/test/controller | |
parent | ae7f109cce040746cebada0dd01f80071eace1f1 (diff) | |
download | rails-0c3ca0f013904d40bf11ac9da95ed0ef3d9ddc86.tar.gz rails-0c3ca0f013904d40bf11ac9da95ed0ef3d9ddc86.tar.bz2 rails-0c3ca0f013904d40bf11ac9da95ed0ef3d9ddc86.zip |
Permit string and float values in the multiparameter attributes
Diffstat (limited to 'actionpack/test/controller')
-rw-r--r-- | actionpack/test/controller/parameters/multi_parameter_attributes_test.rb | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/actionpack/test/controller/parameters/multi_parameter_attributes_test.rb b/actionpack/test/controller/parameters/multi_parameter_attributes_test.rb index 2214ec769c..15338059bc 100644 --- a/actionpack/test/controller/parameters/multi_parameter_attributes_test.rb +++ b/actionpack/test/controller/parameters/multi_parameter_attributes_test.rb @@ -5,18 +5,20 @@ class MultiParameterAttributesTest < ActiveSupport::TestCase test "permitted multi-parameter attribute keys" do params = ActionController::Parameters.new({ book: { - "shipped_at(1i)" => "2012", - "shipped_at(2i)" => "3", - "shipped_at(3i)" => "25", - "shipped_at(4i)" => "10", - "shipped_at(5i)" => "15", - "published_at(1i)" => "1999", - "published_at(2i)" => "2", - "published_at(3i)" => "5" + "shipped_at(1i)" => "2012", + "shipped_at(2i)" => "3", + "shipped_at(3i)" => "25", + "shipped_at(4i)" => "10", + "shipped_at(5i)" => "15", + "published_at(1i)" => "1999", + "published_at(2i)" => "2", + "published_at(3i)" => "5", + "price(1)" => "R$", + "price(2f)" => "2.02" } }) - permitted = params.permit book: [ :shipped_at ] + permitted = params.permit book: [ :shipped_at, :price ] assert permitted.permitted? @@ -26,6 +28,9 @@ class MultiParameterAttributesTest < ActiveSupport::TestCase assert_equal "10", permitted[:book]["shipped_at(4i)"] assert_equal "15", permitted[:book]["shipped_at(5i)"] + assert_equal "R$", permitted[:book]["price(1)"] + assert_equal "2.02", permitted[:book]["price(2f)"] + assert_nil permitted[:book]["published_at(1i)"] assert_nil permitted[:book]["published_at(2i)"] assert_nil permitted[:book]["published_at(3i)"] |