diff options
author | Josh Kalderimis <josh.kalderimis@gmail.com> | 2011-03-31 18:25:29 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2011-03-31 18:53:36 +0200 |
commit | b45302d7676a5e38d82662f9068ee6d832ff2e3c (patch) | |
tree | 5b3cef136b674cef822d355ddbaca2c6580304d8 /actionpack/test/controller | |
parent | 48404a751d7cab1556c390a5915c90947d56b46e (diff) | |
download | rails-b45302d7676a5e38d82662f9068ee6d832ff2e3c.tar.gz rails-b45302d7676a5e38d82662f9068ee6d832ff2e3c.tar.bz2 rails-b45302d7676a5e38d82662f9068ee6d832ff2e3c.zip |
pass respond_with options to controller render when using a template for api navigation
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'actionpack/test/controller')
-rw-r--r-- | actionpack/test/controller/mime_responds_test.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/actionpack/test/controller/mime_responds_test.rb b/actionpack/test/controller/mime_responds_test.rb index 4fde08b3f5..41f80d0784 100644 --- a/actionpack/test/controller/mime_responds_test.rb +++ b/actionpack/test/controller/mime_responds_test.rb @@ -562,6 +562,11 @@ class RespondWithController < ActionController::Base respond_with(resource) end + def using_options_with_template + @customer = resource + respond_with(@customer, :status => 123, :location => "http://test.host/") + end + def using_resource_with_responder responder = proc { |c, r, o| c.render :text => "Resource name is #{r.first.name}" } respond_with(resource, :responder => responder) @@ -991,6 +996,20 @@ class RespondWithControllerTest < ActionController::TestCase assert_equal nil, @response.location end + def test_using_options_with_template + @request.accept = "text/xml" + + post :using_options_with_template + assert_equal "<customer-name>david</customer-name>", @response.body + assert_equal 123, @response.status + assert_equal "http://test.host/", @response.location + + put :using_options_with_template + assert_equal "<customer-name>david</customer-name>", @response.body + assert_equal 123, @response.status + assert_equal "http://test.host/", @response.location + end + def test_using_resource_with_responder get :using_resource_with_responder assert_equal "Resource name is david", @response.body |