Permalink
Browse files

Test controller layout

  • Loading branch information...
1 parent 890321e commit 7a86f8ea90f88a388b3093471d60b3019ea8ebac @wycats wycats committed Mar 19, 2009
@@ -77,7 +77,23 @@ class TestRenderActionWithSymbol < SimpleRouteCase
class RenderActionWithLayoutController < ActionController::Base2
# Set the view path to an application view structure with layouts
- self.view_paths = [File.join(File.dirname(__FILE__), 'views', 'with_layout')]
+ self.view_paths = [File.join(File.dirname(__FILE__), 'views', 'with_application_layout')]
+
+ def hello_world
+ render :action => "hello_world"
+ end
+ end
+
+ class RenderActionWithControllerLayoutController < ActionController::Base2
+ self.view_paths = [File.join(File.dirname(__FILE__), 'views', 'with_controller_layout')]
+
+ def hello_world
+ render :action => "hello_world"
+ end
+ end
+
+ class RenderActionWithControllerLayoutFirstController < ActionController::Base2
+ self.view_paths = [File.join(File.dirname(__FILE__), 'views', 'with_both_layouts')]
def hello_world
render :action => "hello_world"
@@ -94,5 +110,22 @@ class TestRenderActionWithLayout < SimpleRouteCase
assert_body "OHAI Hello World! KTHXBAI"
assert_status 200
end
-
+
+ class TestRenderActionWithControllerLayout < SimpleRouteCase
+ describe "Render hello_world and implicitly use <controller_path>.html.erb as a layout."
+
+ get "/happy_path/render_action_with_controller_layout/hello_world"
+ assert_body "With Controller Layout! Hello World! KTHXBAI"
+ assert_status 200
+ end
+
+ class TestRenderActionWithControllerLayoutFirst < SimpleRouteCase
+ describe "Render hello_world and implicitly use <controller_path>.html.erb over application.html.erb as a layout"
+
+ get "/happy_path/render_action_with_controller_layout_first/hello_world"
+ assert_body "With Controller Layout! Hello World! KTHXBAI"
+ assert_status 200
+ end
+
+ # TODO: Implement a FixtureViewPath
end
@@ -0,0 +1 @@
+OHAI <%= yield %> KTHXBAI
@@ -0,0 +1 @@
+With Controller Layout! <%= yield %> KTHXBAI
@@ -0,0 +1 @@
+With Controller Layout! <%= yield %> KTHXBAI

0 comments on commit 7a86f8e

Please sign in to comment.