diff options
author | José Valim <jose.valim@gmail.com> | 2011-05-15 16:13:29 -0700 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2011-05-15 16:13:29 -0700 |
commit | d043d6539682f804a696d301b580accfc68f6cce (patch) | |
tree | d1303b0c4dc8a2ed14725c12eec300b7e1fa3bb5 /actionpack/test/controller/params_wrapper_test.rb | |
parent | 6e581cce1c1116d71484a5a4a5f92f0ea6fd29e4 (diff) | |
parent | d77b306b63e20aabec5daf7159d31c8ee31492c9 (diff) | |
download | rails-d043d6539682f804a696d301b580accfc68f6cce.tar.gz rails-d043d6539682f804a696d301b580accfc68f6cce.tar.bz2 rails-d043d6539682f804a696d301b580accfc68f6cce.zip |
Merge pull request #570 from sikachu/decouple_actionpack
Make ParamsWrapper use a well-defined API and not rely on AR methods
Diffstat (limited to 'actionpack/test/controller/params_wrapper_test.rb')
-rw-r--r-- | actionpack/test/controller/params_wrapper_test.rb | 18 |
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 |