aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller
diff options
context:
space:
mode:
authorPrem Sichanugrist <s@sikachu.com>2011-05-15 14:25:00 -0400
committerPrem Sichanugrist <s@sikachu.com>2011-05-15 19:07:44 -0400
commitd77b306b63e20aabec5daf7159d31c8ee31492c9 (patch)
tree74bf89347455aabce1f3a4e0fe080097da9e08fe /actionpack/test/controller
parent5ca67eca21d2adfb418f96b63e7d3de237737a1e (diff)
downloadrails-d77b306b63e20aabec5daf7159d31c8ee31492c9.tar.gz
rails-d77b306b63e20aabec5daf7159d31c8ee31492c9.tar.bz2
rails-d77b306b63e20aabec5daf7159d31c8ee31492c9.zip
Make ParamsWrapper calling newly introduced `Model.attribute_names` instead of `.column_names`
Diffstat (limited to 'actionpack/test/controller')
-rw-r--r--actionpack/test/controller/params_wrapper_test.rb18
1 files changed, 8 insertions, 10 deletions
diff --git a/actionpack/test/controller/params_wrapper_test.rb b/actionpack/test/controller/params_wrapper_test.rb
index bed4a6a553..ae4ad8eb9c 100644
--- a/actionpack/test/controller/params_wrapper_test.rb
+++ b/actionpack/test/controller/params_wrapper_test.rb
@@ -133,9 +133,8 @@ class ParamsWrapperTest < ActionController::TestCase
end
def test_derived_wrapped_keys_from_matching_model
- User.expects(:respond_to?).with(:abstract_class?).returns(false)
- User.expects(:respond_to?).with(:column_names).returns(true)
- User.expects(:column_names).returns(["username"])
+ User.expects(:respond_to?).with(:attribute_names).returns(true)
+ User.expects(:attribute_names).twice.returns(["username"])
with_default_wrapper_options do
@request.env['CONTENT_TYPE'] = 'application/json'
@@ -146,9 +145,8 @@ class ParamsWrapperTest < ActionController::TestCase
def test_derived_wrapped_keys_from_specified_model
with_default_wrapper_options do
- Person.expects(:respond_to?).with(:abstract_class?).returns(false)
- Person.expects(:respond_to?).with(:column_names).returns(true)
- Person.expects(:column_names).returns(["username"])
+ Person.expects(:respond_to?).with(:attribute_names).returns(true)
+ Person.expects(:attribute_names).twice.returns(["username"])
UsersController.wrap_parameters Person
@@ -159,8 +157,8 @@ class ParamsWrapperTest < ActionController::TestCase
end
def test_not_wrapping_abstract_model
- User.expects(:respond_to?).with(:abstract_class?).returns(true)
- User.expects(:abstract_class?).returns(true)
+ User.expects(:respond_to?).with(:attribute_names).returns(true)
+ User.expects(:attribute_names).returns([])
with_default_wrapper_options do
@request.env['CONTENT_TYPE'] = 'application/json'
@@ -198,13 +196,13 @@ class NamespacedParamsWrapperTest < ActionController::TestCase
end
class SampleOne
- def self.column_names
+ def self.attribute_names
["username"]
end
end
class SampleTwo
- def self.column_names
+ def self.attribute_names
["title"]
end
end