From db045dbbf60b53dbe013ef25554fd013baf88134 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Wed, 24 Nov 2004 01:04:44 +0000 Subject: Initial git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/test/controller/layout_test.rb | 49 +++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 actionpack/test/controller/layout_test.rb (limited to 'actionpack/test/controller/layout_test.rb') diff --git a/actionpack/test/controller/layout_test.rb b/actionpack/test/controller/layout_test.rb new file mode 100644 index 0000000000..f652453ebd --- /dev/null +++ b/actionpack/test/controller/layout_test.rb @@ -0,0 +1,49 @@ +require File.dirname(__FILE__) + '/../abstract_unit' + +class TestLayoutController < ActionController::Base + layout "layouts/standard" + + def hello_world + end + + def hello_world_outside_layout + end + + def rescue_action(e) raise end +end + +class ChildWithoutTestLayoutController < TestLayoutController + layout nil + + def hello_world + end +end + +class ChildWithOtherTestLayoutController < TestLayoutController + layout nil + + def hello_world + end +end + +class RenderTest < Test::Unit::TestCase + def setup + @request = ActionController::TestRequest.new + @response = ActionController::TestResponse.new + + @request.host = "www.nextangle.com" + end + + def test_layout_rendering + @request.action = "hello_world" + response = process_request + assert_equal "200 OK", response.headers["Status"] + assert_equal "layouts/standard", response.template.template_name + end + + + private + def process_request + TestLayoutController.process(@request, @response) + end +end \ No newline at end of file -- cgit v1.2.3