diff options
author | Andrew White <pixeltrix@users.noreply.github.com> | 2017-03-28 17:27:10 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-28 17:27:10 +0100 |
commit | 5307f8d49cc4d8a5fb331335be4f3b51d83c217d (patch) | |
tree | c5b8271c1c03e385be2322feaa8326273133a1cb /actionpack | |
parent | 1c682af73abcc12562291de8f93bfe2adbe014d7 (diff) | |
parent | edcbb2e5b7505e072ae981a4eb5b23dc5d537e42 (diff) | |
download | rails-5307f8d49cc4d8a5fb331335be4f3b51d83c217d.tar.gz rails-5307f8d49cc4d8a5fb331335be4f3b51d83c217d.tar.bz2 rails-5307f8d49cc4d8a5fb331335be4f3b51d83c217d.zip |
Merge pull request #28514 from y-yagi/follow_up_to_28056
Fix store accessors in parameters test
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/test/controller/params_wrapper_test.rb | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/actionpack/test/controller/params_wrapper_test.rb b/actionpack/test/controller/params_wrapper_test.rb index 1eb92abae4..2a41d57b26 100644 --- a/actionpack/test/controller/params_wrapper_test.rb +++ b/actionpack/test/controller/params_wrapper_test.rb @@ -32,13 +32,13 @@ class ParamsWrapperTest < ActionController::TestCase def self.attribute_names [] end - end - class Person - def self.stores_attributes + def self.stored_attributes { settings: [:color, :size] } end + end + class Person def self.attribute_names [] end @@ -67,11 +67,13 @@ class ParamsWrapperTest < ActionController::TestCase 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" }) + 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", "color" => "blue", "size" => "large" } + assert_parameters("username" => "sikachu", "color" => "blue", "size" => "large", + "user" => { "username" => "sikachu", "color" => "blue", "size" => "large" }) + end end end |