aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/new_base/render_layout_test.rb
diff options
context:
space:
mode:
authorJoshua Peek <josh@joshpeek.com>2009-10-03 21:05:51 -0500
committerJoshua Peek <josh@joshpeek.com>2009-10-03 21:05:51 -0500
commit018b79dd36d054d87fdc408d38dc9ac7f1b1500d (patch)
treea954ecef58682b2d259432a04ce503f8bb865840 /actionpack/test/new_base/render_layout_test.rb
parent84e94551f62d3bcbc71f1c6f3fda738342d984e2 (diff)
downloadrails-018b79dd36d054d87fdc408d38dc9ac7f1b1500d.tar.gz
rails-018b79dd36d054d87fdc408d38dc9ac7f1b1500d.tar.bz2
rails-018b79dd36d054d87fdc408d38dc9ac7f1b1500d.zip
File extra test folders into controller, dispatch, or template
Diffstat (limited to 'actionpack/test/new_base/render_layout_test.rb')
-rw-r--r--actionpack/test/new_base/render_layout_test.rb101
1 files changed, 0 insertions, 101 deletions
diff --git a/actionpack/test/new_base/render_layout_test.rb b/actionpack/test/new_base/render_layout_test.rb
deleted file mode 100644
index f840a47ecf..0000000000
--- a/actionpack/test/new_base/render_layout_test.rb
+++ /dev/null
@@ -1,101 +0,0 @@
-require 'abstract_unit'
-
-module ControllerLayouts
- class ImplicitController < ::ApplicationController
- self.view_paths = [ActionView::FixtureResolver.new(
- "layouts/application.html.erb" => "OMG <%= yield %> KTHXBAI",
- "layouts/override.html.erb" => "Override! <%= yield %>",
- "basic.html.erb" => "Hello world!",
- "controller_layouts/implicit/layout_false.html.erb" => "hai(layout_false.html.erb)"
- )]
-
- def index
- render :template => "basic"
- end
-
- def override
- render :template => "basic", :layout => "override"
- end
-
- def layout_false
- render :layout => false
- end
-
- def builder_override
- end
- end
-
- class ImplicitNameController < ::ApplicationController
- self.view_paths = [ActionView::FixtureResolver.new(
- "layouts/controller_layouts/implicit_name.html.erb" => "OMGIMPLICIT <%= yield %> KTHXBAI",
- "basic.html.erb" => "Hello world!"
- )]
-
- def index
- render :template => "basic"
- end
- end
-
- class RenderLayoutTest < SimpleRouteCase
- test "rendering a normal template, but using the implicit layout" do
- get "/controller_layouts/implicit/index"
-
- assert_body "OMG Hello world! KTHXBAI"
- assert_status 200
- end
-
- test "rendering a normal template, but using an implicit NAMED layout" do
- get "/controller_layouts/implicit_name/index"
-
- assert_body "OMGIMPLICIT Hello world! KTHXBAI"
- assert_status 200
- end
-
- test "overriding an implicit layout with render :layout option" do
- get "/controller_layouts/implicit/override"
- assert_body "Override! Hello world!"
- end
-
- end
-
- class LayoutOptionsTest < SimpleRouteCase
- testing ControllerLayouts::ImplicitController
-
- test "rendering with :layout => false leaves out the implicit layout" do
- get :layout_false
- assert_response "hai(layout_false.html.erb)"
- end
- end
-
- class MismatchFormatController < ::ApplicationController
- self.view_paths = [ActionView::FixtureResolver.new(
- "layouts/application.html.erb" => "<html><%= yield %></html>",
- "controller_layouts/mismatch_format/index.js.rjs" => "page[:test].omg",
- "controller_layouts/mismatch_format/implicit.rjs" => "page[:test].omg"
- )]
-
- def explicit
- render :layout => "application"
- end
- end
-
- class MismatchFormatTest < SimpleRouteCase
- testing ControllerLayouts::MismatchFormatController
-
- test "if JS is selected, an HTML template is not also selected" do
- get :index, "format" => "js"
- assert_response "$(\"test\").omg();"
- end
-
- test "if JS is implicitly selected, an HTML template is not also selected" do
- get :implicit
- assert_response "$(\"test\").omg();"
- end
-
- test "if an HTML template is explicitly provides for a JS template, an error is raised" do
- assert_raises ActionView::MissingTemplate do
- get :explicit, {}, "action_dispatch.show_exceptions" => false
- end
- end
- end
-end