diff options
author | Sid Ngeth <sngeth@gmail.com> | 2017-02-17 17:03:09 -0500 |
---|---|---|
committer | Sid Ngeth <sngeth@gmail.com> | 2017-03-21 15:47:29 -0400 |
commit | ea5aa2525b4fbc7d8323a7e4c3ee98db2ee5acb4 (patch) | |
tree | 84a9ad474e5e2518d7b7e89a81470988f2007501 /actionpack/test | |
parent | 843345cae59b73e50af685ac1303a419a06b4c91 (diff) | |
download | rails-ea5aa2525b4fbc7d8323a7e4c3ee98db2ee5acb4.tar.gz rails-ea5aa2525b4fbc7d8323a7e4c3ee98db2ee5acb4.tar.bz2 rails-ea5aa2525b4fbc7d8323a7e4c3ee98db2ee5acb4.zip |
Wrap store accessors in parameters
Modified params wrapper to account for model's stored_attributes
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/controller/params_wrapper_test.rb | 13 |
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 |