Skip to content

Commit

Permalink
Merge pull request #28514 from y-yagi/follow_up_to_28056
Browse files Browse the repository at this point in the history
Fix store accessors in parameters test
  • Loading branch information
pixeltrix committed Mar 28, 2017
2 parents 1c682af + edcbb2e commit 5307f8d
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions actionpack/test/controller/params_wrapper_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ class User
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
Expand Down Expand Up @@ -67,11 +67,13 @@ def test_derived_name_from_controller
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

Expand Down

0 comments on commit 5307f8d

Please sign in to comment.