diff options
author | José Valim <jose.valim@gmail.com> | 2009-08-06 23:48:48 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2009-08-07 17:17:51 +0200 |
commit | aed135d3e261cbee153a35fcfbeb47e2e02b12e4 (patch) | |
tree | ab3b3ff0b8cbd632f34d938bf1117b075f4813a7 /actionpack/test/controller | |
parent | 1fd65c80fcdc6080b9efa27f41dbb7f7d95a17c6 (diff) | |
download | rails-aed135d3e261cbee153a35fcfbeb47e2e02b12e4.tar.gz rails-aed135d3e261cbee153a35fcfbeb47e2e02b12e4.tar.bz2 rails-aed135d3e261cbee153a35fcfbeb47e2e02b12e4.zip |
Renamed presenter to renderer, added some documentation and defined its API.
Diffstat (limited to 'actionpack/test/controller')
-rw-r--r-- | actionpack/test/controller/mime_responds_test.rb | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/actionpack/test/controller/mime_responds_test.rb b/actionpack/test/controller/mime_responds_test.rb index 157e837503..00ad90ff68 100644 --- a/actionpack/test/controller/mime_responds_test.rb +++ b/actionpack/test/controller/mime_responds_test.rb @@ -501,8 +501,13 @@ class RespondWithController < ActionController::Base respond_with([Quiz::Store.new("developer?", 11), Customer.new("david", 13)]) end - def using_resource_with_location - respond_with(Customer.new("david", 13), :location => "http://test.host/") + def using_resource_with_status_and_location + respond_with(Customer.new("david", 13), :location => "http://test.host/", :status => :created) + end + + def using_resource_with_renderer + renderer = proc { |c, r, o| c.render :text => "Resource name is #{r.name}" } + respond_with(Customer.new("david", 13), :renderer => renderer) end protected @@ -727,11 +732,20 @@ class RespondWithControllerTest < ActionController::TestCase end end - def test_using_resource_with_location + def test_using_resource_with_status_and_location @request.accept = "text/html" - post :using_resource_with_location + post :using_resource_with_status_and_location assert @response.redirect? assert_equal "http://test.host/", @response.location + + @request.accept = "application/xml" + get :using_resource_with_status_and_location + assert_equal 201, @response.status + end + + def test_using_resource_with_renderer + get :using_resource_with_renderer + assert_equal "Resource name is david", @response.body end def test_not_acceptable |