From 652d6dd421a43936e005661c354bc24ee4f6c987 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wojciech=20Wn=C4=99trzak?= Date: Fri, 11 Feb 2011 10:55:22 +0100 Subject: [PATCH] test for POST request when argument of respond_with is array of resources --- actionpack/test/controller/mime_responds_test.rb | 16 +++++++++++++++- 1 files changed, 15 insertions(+), 1 deletions(-) diff --git a/actionpack/test/controller/mime_responds_test.rb b/actionpack/test/controller/mime_responds_test.rb index 5debf96..6afbab9 100644 --- a/actionpack/test/controller/mime_responds_test.rb +++ b/actionpack/test/controller/mime_responds_test.rb @@ -881,6 +881,18 @@ class RespondWithControllerTest < ActionController::TestCase assert_match(/jamis<\/name>/, @response.body) end + def test_using_resource_with_collection_for_post + with_test_route_set do + @request.accept = "application/xml" + errors = { :name => :invalid } + Customer.any_instance.stubs(:errors).returns(errors) + post :using_resource_with_collection + assert_equal 422, @response.status + assert_equal errors.to_xml, @response.body + assert_nil @response.location + end + end + def test_using_resource_with_action @controller.instance_eval do def render(params={}) @@ -978,7 +990,9 @@ class RespondWithControllerTest < ActionController::TestCase def with_test_route_set with_routing do |set| set.draw do - resources :customers + resources :customers do + resources :customers + end resources :quiz_stores do resources :customers end -- 1.7.1.1