From d77b306b63e20aabec5daf7159d31c8ee31492c9 Mon Sep 17 00:00:00 2001 From: Prem Sichanugrist Date: Sun, 15 May 2011 14:25:00 -0400 Subject: Make ParamsWrapper calling newly introduced `Model.attribute_names` instead of `.column_names` --- actionpack/test/controller/params_wrapper_test.rb | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'actionpack/test/controller/params_wrapper_test.rb') 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 -- cgit v1.2.3