diff options
author | Josh Kalderimis <josh.kalderimis@gmail.com> | 2011-03-30 20:53:42 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2011-03-31 18:53:21 +0200 |
commit | 9766997f4ce26fe0d97d7b9eebf885ddb517c80c (patch) | |
tree | a148dca326c7b7e7e00fd71e3328332e5cbe8af7 /actionpack/test | |
parent | 286709336577c767498785bc7be486eefe3faa4b (diff) | |
download | rails-9766997f4ce26fe0d97d7b9eebf885ddb517c80c.tar.gz rails-9766997f4ce26fe0d97d7b9eebf885ddb517c80c.tar.bz2 rails-9766997f4ce26fe0d97d7b9eebf885ddb517c80c.zip |
when using respond_with with an invalid resource and custom options, the default response status and error messages should be returned
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/controller/mime_responds_test.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/actionpack/test/controller/mime_responds_test.rb b/actionpack/test/controller/mime_responds_test.rb index 5debf96232..eead857927 100644 --- a/actionpack/test/controller/mime_responds_test.rb +++ b/actionpack/test/controller/mime_responds_test.rb @@ -953,6 +953,23 @@ class RespondWithControllerTest < ActionController::TestCase assert_equal 201, @response.status end + def test_using_resource_with_status_and_location_with_invalid_resource + errors = { :name => :invalid } + Customer.any_instance.stubs(:errors).returns(errors) + + @request.accept = "text/xml" + + post :using_resource_with_status_and_location + assert_equal errors.to_xml, @response.body + assert_equal 422, @response.status + assert_equal nil, @response.location + + put :using_resource_with_status_and_location + assert_equal errors.to_xml, @response.body + assert_equal 422, @response.status + assert_equal nil, @response.location + end + def test_using_resource_with_responder get :using_resource_with_responder assert_equal "Resource name is david", @response.body |