aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew White <pixeltrix@users.noreply.github.com>2017-03-28 17:27:10 +0100
committerGitHub <noreply@github.com>2017-03-28 17:27:10 +0100
commit5307f8d49cc4d8a5fb331335be4f3b51d83c217d (patch)
treec5b8271c1c03e385be2322feaa8326273133a1cb
parent1c682af73abcc12562291de8f93bfe2adbe014d7 (diff)
parentedcbb2e5b7505e072ae981a4eb5b23dc5d537e42 (diff)
downloadrails-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
-rw-r--r--actionpack/test/controller/params_wrapper_test.rb18
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