Test for no layout on nothing

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1354 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
David Heinemeier Hansson 2005-05-22 16:59:55 +00:00
parent bdd16a75e6
commit c41f0cc720
1 changed files with 10 additions and 1 deletions

View File

@ -58,6 +58,10 @@ class TestController < ActionController::Base
render :action => "hello_world", :layout => false render :action => "hello_world", :layout => false
end end
def rendering_nothing_on_layout
render :nothing => true
end
def builder_layout_test def builder_layout_test
render :action => "hello" render :action => "hello"
end end
@ -85,7 +89,7 @@ class TestController < ActionController::Base
private private
def determine_layout def determine_layout
case action_name case action_name
when "layout_test", "rendering_without_layout" when "layout_test", "rendering_without_layout", "rendering_nothing_on_layout"
"layouts/standard" "layouts/standard"
when "builder_layout_test" when "builder_layout_test"
"layouts/builder" "layouts/builder"
@ -199,6 +203,11 @@ class RenderTest < Test::Unit::TestCase
assert_equal "Hello world!", process_request.body assert_equal "Hello world!", process_request.body
end end
def test_rendering_nothing_on_layout
@request.action = "rendering_nothing_on_layout"
assert_equal "", process_request.body
end
def test_render_xml_with_layouts def test_render_xml_with_layouts
@request.action = "builder_layout_test" @request.action = "builder_layout_test"
assert_equal "<wrapper>\n<html>\n <p>Hello </p>\n<p>This is grand!</p>\n</html>\n</wrapper>\n", process_request.body assert_equal "<wrapper>\n<html>\n <p>Hello </p>\n<p>This is grand!</p>\n</html>\n</wrapper>\n", process_request.body