From 860cf2d44e01114af8ce83fffee3689df812a55c Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sun, 30 Sep 2007 22:59:24 +0000 Subject: Fixed that render template did not honor exempt_from_layout (closes #9698) [pezra] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7701 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/test/controller/layout_test.rb | 18 ++++++++++++++++++ actionpack/test/fixtures/layout_tests/alt/hello.rhtml | 1 + 2 files changed, 19 insertions(+) create mode 100644 actionpack/test/fixtures/layout_tests/alt/hello.rhtml (limited to 'actionpack/test') diff --git a/actionpack/test/controller/layout_test.rb b/actionpack/test/controller/layout_test.rb index cad5720742..f194539fcf 100644 --- a/actionpack/test/controller/layout_test.rb +++ b/actionpack/test/controller/layout_test.rb @@ -180,8 +180,26 @@ class LayoutSetInResponseTest < Test::Unit::TestCase get :hello assert_nil @response.layout end + + def test_exempt_from_layout_honored_by_render_template + ActionController::Base.exempt_from_layout :rhtml + @controller = RenderWithTemplateOptionController.new + + assert @controller.send(:template_exempt_from_layout?, 'alt/hello.rhtml') + + get :hello + assert_equal "alt/hello.rhtml", @response.body.strip + + ensure + ActionController::Base.exempt_from_layout.delete(/\.rhtml$/) + end end +class RenderWithTemplateOptionController < LayoutTest + def hello + render :template => 'alt/hello' + end +end class SetsNonExistentLayoutFile < LayoutTest layout "nofile.rhtml" diff --git a/actionpack/test/fixtures/layout_tests/alt/hello.rhtml b/actionpack/test/fixtures/layout_tests/alt/hello.rhtml new file mode 100644 index 0000000000..fcda6cf97a --- /dev/null +++ b/actionpack/test/fixtures/layout_tests/alt/hello.rhtml @@ -0,0 +1 @@ +alt/hello.rhtml -- cgit v1.2.3