diff options
Diffstat (limited to 'actionpack/test/controller/new_render_test.rb')
-rw-r--r-- | actionpack/test/controller/new_render_test.rb | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/actionpack/test/controller/new_render_test.rb b/actionpack/test/controller/new_render_test.rb index 0765772e06..18a32f6e30 100644 --- a/actionpack/test/controller/new_render_test.rb +++ b/actionpack/test/controller/new_render_test.rb @@ -258,6 +258,20 @@ class NewRenderTestController < ActionController::Base head :forbidden, :x_custom_header => "something" end + def render_with_location + render :xml => "<hello/>", :location => "http://example.com", :status => 201 + end + + def render_with_to_xml + to_xmlable = Class.new do + def to_xml + "<i-am-xml/>" + end + end.new + + render :xml => to_xmlable + end + helper NewRenderTestHelper helper do def rjs_helper_method(value) @@ -742,4 +756,14 @@ EOS assert_equal "something", @response.headers["X-Custom-Header"] assert_response :forbidden end -end + + def test_rendering_with_location_should_set_header + get :render_with_location + assert_equal "http://example.com", @response.headers["Location"] + end + + def test_rendering_xml_should_call_to_xml_if_possible + get :render_with_to_xml + assert_equal "<i-am-xml/>", @response.body + end +end
\ No newline at end of file |