aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller
diff options
context:
space:
mode:
authorRafael França <rafaelmfranca@gmail.com>2017-03-21 16:52:47 -0400
committerGitHub <noreply@github.com>2017-03-21 16:52:47 -0400
commit88b16843f67bcd96395444ba8f139895351da0bc (patch)
tree23c04e185936996f1e3d10cf5d71cb4f1022ecfe /actionpack/test/controller
parentb7bd4e2848145fe6b342d510b9e250ab7799563c (diff)
parentea5aa2525b4fbc7d8323a7e4c3ee98db2ee5acb4 (diff)
downloadrails-88b16843f67bcd96395444ba8f139895351da0bc.tar.gz
rails-88b16843f67bcd96395444ba8f139895351da0bc.tar.bz2
rails-88b16843f67bcd96395444ba8f139895351da0bc.zip
Merge pull request #28056 from sngeth/wrap_store_accessors_in_params
Wrap stored accessors in parameters
Diffstat (limited to 'actionpack/test/controller')
-rw-r--r--actionpack/test/controller/params_wrapper_test.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/actionpack/test/controller/params_wrapper_test.rb b/actionpack/test/controller/params_wrapper_test.rb
index faa57c4559..1eb92abae4 100644
--- a/actionpack/test/controller/params_wrapper_test.rb
+++ b/actionpack/test/controller/params_wrapper_test.rb
@@ -35,6 +35,10 @@ class ParamsWrapperTest < ActionController::TestCase
end
class Person
+ def self.stores_attributes
+ { settings: [:color, :size] }
+ end
+
def self.attribute_names
[]
end
@@ -62,6 +66,15 @@ class ParamsWrapperTest < ActionController::TestCase
end
end
+ def test_store_accessors_wrapped
+ with_default_wrapper_options do
+ @request.env["CONTENT_TYPE"] = "application/json"
+ post :parse, params: { "username" => "sikachu", "color" => "blue", "size" => "large" }
+ assert_parameters("username" => "sikachu", "color" => "blue", "size" => "large",
+ "user" => { "username" => "sikachu", "color" => "blue", "size" => "large" })
+ end
+ end
+
def test_specify_wrapper_name
with_default_wrapper_options do
UsersController.wrap_parameters :person