From 8fac2c88cae0f2fd42fad3c2c2c6c860df14d629 Mon Sep 17 00:00:00 2001 From: Yehuda Katz + Carl Lerche Date: Thu, 14 May 2009 15:30:35 -0700 Subject: Cleaning up more render tests --- actionpack/test/new_base/render_action_test.rb | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'actionpack/test/new_base/render_action_test.rb') diff --git a/actionpack/test/new_base/render_action_test.rb b/actionpack/test/new_base/render_action_test.rb index 348d70381b..f25faee433 100644 --- a/actionpack/test/new_base/render_action_test.rb +++ b/actionpack/test/new_base/render_action_test.rb @@ -131,8 +131,10 @@ module RenderActionWithApplicationLayout # Set the view path to an application view structure with layouts self.view_paths = self.view_paths = [ActionView::Template::FixturePath.new( "render_action_with_application_layout/basic/hello_world.html.erb" => "Hello World!", + "render_action_with_application_layout/basic/hello.html.builder" => "xml.p 'Omg'", "layouts/application.html.erb" => "OHAI <%= yield %> KTHXBAI", - "layouts/greetings.html.erb" => "Greetings <%= yield %> Bai" + "layouts/greetings.html.erb" => "Greetings <%= yield %> Bai", + "layouts/builder.html.builder" => "xml.html do\n xml << yield\nend" )] def hello_world @@ -154,6 +156,10 @@ module RenderActionWithApplicationLayout def hello_world_with_custom_layout render :action => "hello_world", :layout => "greetings" end + + def with_builder_and_layout + render :action => "hello", :layout => "builder" + end end class TestDefaultLayout < SimpleRouteCase @@ -199,6 +205,15 @@ module RenderActionWithApplicationLayout assert_status 200 end + class TestLayout < SimpleRouteCase + testing BasicController + + test "builder works with layouts" do + get :with_builder_and_layout + assert_response "\n

Omg

\n\n" + end + end + end module RenderActionWithControllerLayout -- cgit v1.2.3 From 7f318c3ec535afe53733c55cd0ecaccc16a8b944 Mon Sep 17 00:00:00 2001 From: Bryan Helmkamp Date: Sat, 16 May 2009 14:15:26 -0400 Subject: Instead of checking Rails.env.test? in Failsafe middleware, check env["rails.raise_exceptions"] --- actionpack/test/new_base/render_action_test.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'actionpack/test/new_base/render_action_test.rb') diff --git a/actionpack/test/new_base/render_action_test.rb b/actionpack/test/new_base/render_action_test.rb index f25faee433..96666077d2 100644 --- a/actionpack/test/new_base/render_action_test.rb +++ b/actionpack/test/new_base/render_action_test.rb @@ -92,7 +92,7 @@ module RenderAction test "raises an exception when requesting a layout and none exist" do assert_raise(ArgumentError, /no default layout for RenderAction::BasicController in/) do - get "/render_action/basic/hello_world_with_layout" + get "/render_action/basic/hello_world_with_layout", {}, "rails.raise_exceptions" => true end end end @@ -117,7 +117,9 @@ module RenderAction describe "rendering a normal template with full path with layout => 'greetings'" test "raises an exception when requesting a layout that does not exist" do - assert_raise(ActionView::MissingTemplate) { get "/render_action/basic/hello_world_with_custom_layout" } + assert_raise(ActionView::MissingTemplate) do + get "/render_action/basic/hello_world_with_custom_layout", {}, "rails.raise_exceptions" => true + end end end -- cgit v1.2.3 From 8118fca9beec675fba19395e7d1027eaa4b5703a Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Sun, 17 May 2009 12:24:42 -0500 Subject: Merge Failsafe middleware into ShowExceptions --- actionpack/test/new_base/render_action_test.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'actionpack/test/new_base/render_action_test.rb') diff --git a/actionpack/test/new_base/render_action_test.rb b/actionpack/test/new_base/render_action_test.rb index 96666077d2..626c7b3540 100644 --- a/actionpack/test/new_base/render_action_test.rb +++ b/actionpack/test/new_base/render_action_test.rb @@ -92,7 +92,7 @@ module RenderAction test "raises an exception when requesting a layout and none exist" do assert_raise(ArgumentError, /no default layout for RenderAction::BasicController in/) do - get "/render_action/basic/hello_world_with_layout", {}, "rails.raise_exceptions" => true + get "/render_action/basic/hello_world_with_layout", {}, "action_dispatch.show_exceptions" => false end end end @@ -118,7 +118,7 @@ module RenderAction test "raises an exception when requesting a layout that does not exist" do assert_raise(ActionView::MissingTemplate) do - get "/render_action/basic/hello_world_with_custom_layout", {}, "rails.raise_exceptions" => true + get "/render_action/basic/hello_world_with_custom_layout", {}, "action_dispatch.show_exceptions" => false end end end -- cgit v1.2.3