diff options
author | Kelton Manzanares <keltonmanzanares@gmail.com> | 2017-10-20 19:07:14 -0600 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2017-10-25 13:16:33 -0400 |
commit | dd423a743e9d47aaa3d15e4f7dc0fc64157cd55c (patch) | |
tree | 6caf2da47c1b5faacf92d1fecec839cefed480e4 /actionpack/test | |
parent | 7b51b140d5da80402a114c06f30fbf66e12c676e (diff) | |
download | rails-dd423a743e9d47aaa3d15e4f7dc0fc64157cd55c.tar.gz rails-dd423a743e9d47aaa3d15e4f7dc0fc64157cd55c.tar.bz2 rails-dd423a743e9d47aaa3d15e4f7dc0fc64157cd55c.zip |
checking for nested attributes when attribute names specified to wrap them as well
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/controller/params_wrapper_test.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/actionpack/test/controller/params_wrapper_test.rb b/actionpack/test/controller/params_wrapper_test.rb index df68ef25a3..41b583d1a7 100644 --- a/actionpack/test/controller/params_wrapper_test.rb +++ b/actionpack/test/controller/params_wrapper_test.rb @@ -255,6 +255,20 @@ class ParamsWrapperTest < ActionController::TestCase assert_equal "", @response.body end end + + def test_derived_wrapped_keys_from_nested_attributes + def User.nested_attributes_options + { person: {} } + end + + assert_called(User, :attribute_names, times: 2, returns: ["username"]) do + with_default_wrapper_options do + @request.env["CONTENT_TYPE"] = "application/json" + post :parse, params: { "username" => "sikachu", "person_attributes" => { "title" => "Developer" } } + assert_parameters("username" => "sikachu", "person_attributes" => { "title" => "Developer" }, "user" => { "username" => "sikachu", "person_attributes" => { "title" => "Developer" } }) + end + end + end end class NamespacedParamsWrapperTest < ActionController::TestCase |