From aed135d3e261cbee153a35fcfbeb47e2e02b12e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Thu, 6 Aug 2009 23:48:48 +0200 Subject: Renamed presenter to renderer, added some documentation and defined its API. --- actionpack/test/controller/mime_responds_test.rb | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'actionpack/test/controller/mime_responds_test.rb') 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 -- cgit v1.2.3