aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYehuda Katz <wycats@gmail.com>2009-03-19 16:11:20 -0700
committerYehuda Katz <wycats@gmail.com>2009-03-19 16:11:20 -0700
commit7a86f8ea90f88a388b3093471d60b3019ea8ebac (patch)
tree5e8570eca0f015e2bcab70f99fc94b0003ba8a4d
parent890321e51e0c51f61f9198d247727e98f7485899 (diff)
downloadrails-7a86f8ea90f88a388b3093471d60b3019ea8ebac.tar.gz
rails-7a86f8ea90f88a388b3093471d60b3019ea8ebac.tar.bz2
rails-7a86f8ea90f88a388b3093471d60b3019ea8ebac.zip
Test controller layout
-rw-r--r--actionpack/test/new_base/render_action_test.rb37
-rw-r--r--actionpack/test/new_base/views/with_application_layout/happy_path/render_action_with_layout/hello_world.html.erb (renamed from actionpack/test/new_base/views/with_layout/happy_path/render_action_with_layout/hello_world.html.erb)0
-rw-r--r--actionpack/test/new_base/views/with_application_layout/layouts/application.html.erb (renamed from actionpack/test/new_base/views/with_layout/layouts/application.html.erb)0
-rw-r--r--actionpack/test/new_base/views/with_both_layouts/happy_path/render_action_with_controller_layout_first/hello_world.html.erb1
-rw-r--r--actionpack/test/new_base/views/with_both_layouts/layouts/application.html.erb1
-rw-r--r--actionpack/test/new_base/views/with_both_layouts/layouts/happy_path/render_action_with_controller_layout_first.html.erb1
-rw-r--r--actionpack/test/new_base/views/with_controller_layout/happy_path/render_action_with_controller_layout/hello_world.html.erb1
-rw-r--r--actionpack/test/new_base/views/with_controller_layout/layouts/happy_path/render_action_with_controller_layout.html.erb1
8 files changed, 40 insertions, 2 deletions
diff --git a/actionpack/test/new_base/render_action_test.rb b/actionpack/test/new_base/render_action_test.rb
index 99482cd4a1..188fb44265 100644
--- a/actionpack/test/new_base/render_action_test.rb
+++ b/actionpack/test/new_base/render_action_test.rb
@@ -77,7 +77,23 @@ module HappyPath
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 @@ module HappyPath
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 \ No newline at end of file
diff --git a/actionpack/test/new_base/views/with_layout/happy_path/render_action_with_layout/hello_world.html.erb b/actionpack/test/new_base/views/with_application_layout/happy_path/render_action_with_layout/hello_world.html.erb
index c57eff55eb..c57eff55eb 100644
--- a/actionpack/test/new_base/views/with_layout/happy_path/render_action_with_layout/hello_world.html.erb
+++ b/actionpack/test/new_base/views/with_application_layout/happy_path/render_action_with_layout/hello_world.html.erb
diff --git a/actionpack/test/new_base/views/with_layout/layouts/application.html.erb b/actionpack/test/new_base/views/with_application_layout/layouts/application.html.erb
index 25f839fded..25f839fded 100644
--- a/actionpack/test/new_base/views/with_layout/layouts/application.html.erb
+++ b/actionpack/test/new_base/views/with_application_layout/layouts/application.html.erb
diff --git a/actionpack/test/new_base/views/with_both_layouts/happy_path/render_action_with_controller_layout_first/hello_world.html.erb b/actionpack/test/new_base/views/with_both_layouts/happy_path/render_action_with_controller_layout_first/hello_world.html.erb
new file mode 100644
index 0000000000..c57eff55eb
--- /dev/null
+++ b/actionpack/test/new_base/views/with_both_layouts/happy_path/render_action_with_controller_layout_first/hello_world.html.erb
@@ -0,0 +1 @@
+Hello World! \ No newline at end of file
diff --git a/actionpack/test/new_base/views/with_both_layouts/layouts/application.html.erb b/actionpack/test/new_base/views/with_both_layouts/layouts/application.html.erb
new file mode 100644
index 0000000000..25f839fded
--- /dev/null
+++ b/actionpack/test/new_base/views/with_both_layouts/layouts/application.html.erb
@@ -0,0 +1 @@
+OHAI <%= yield %> KTHXBAI \ No newline at end of file
diff --git a/actionpack/test/new_base/views/with_both_layouts/layouts/happy_path/render_action_with_controller_layout_first.html.erb b/actionpack/test/new_base/views/with_both_layouts/layouts/happy_path/render_action_with_controller_layout_first.html.erb
new file mode 100644
index 0000000000..43d89fde52
--- /dev/null
+++ b/actionpack/test/new_base/views/with_both_layouts/layouts/happy_path/render_action_with_controller_layout_first.html.erb
@@ -0,0 +1 @@
+With Controller Layout! <%= yield %> KTHXBAI \ No newline at end of file
diff --git a/actionpack/test/new_base/views/with_controller_layout/happy_path/render_action_with_controller_layout/hello_world.html.erb b/actionpack/test/new_base/views/with_controller_layout/happy_path/render_action_with_controller_layout/hello_world.html.erb
new file mode 100644
index 0000000000..c57eff55eb
--- /dev/null
+++ b/actionpack/test/new_base/views/with_controller_layout/happy_path/render_action_with_controller_layout/hello_world.html.erb
@@ -0,0 +1 @@
+Hello World! \ No newline at end of file
diff --git a/actionpack/test/new_base/views/with_controller_layout/layouts/happy_path/render_action_with_controller_layout.html.erb b/actionpack/test/new_base/views/with_controller_layout/layouts/happy_path/render_action_with_controller_layout.html.erb
new file mode 100644
index 0000000000..43d89fde52
--- /dev/null
+++ b/actionpack/test/new_base/views/with_controller_layout/layouts/happy_path/render_action_with_controller_layout.html.erb
@@ -0,0 +1 @@
+With Controller Layout! <%= yield %> KTHXBAI \ No newline at end of file