aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2006-09-16 01:31:17 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2006-09-16 01:31:17 +0000
commit35ffc1afbe583809e7a45945f381cb3b97aac7e9 (patch)
tree3f15c8856bca65f214940a52c473fba811e80060 /actionpack/test
parent2271c17da17511ea0800a60bc5017ba0b2368438 (diff)
downloadrails-35ffc1afbe583809e7a45945f381cb3b97aac7e9.tar.gz
rails-35ffc1afbe583809e7a45945f381cb3b97aac7e9.tar.bz2
rails-35ffc1afbe583809e7a45945f381cb3b97aac7e9.zip
Declare file extensions exempt from layouts. Closes #6219.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5126 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/controller/layout_test.rb33
1 files changed, 33 insertions, 0 deletions
diff --git a/actionpack/test/controller/layout_test.rb b/actionpack/test/controller/layout_test.rb
index bbb13d0320..3e1d3d9644 100644
--- a/actionpack/test/controller/layout_test.rb
+++ b/actionpack/test/controller/layout_test.rb
@@ -72,6 +72,39 @@ class LayoutAutoDiscoveryTest < Test::Unit::TestCase
end
end
+class ExemptFromLayoutTest < Test::Unit::TestCase
+ def setup
+ @controller = LayoutTest.new
+ end
+
+ def test_rjs_exempt_from_layout
+ assert @controller.send(:template_exempt_from_layout?, 'test.rjs')
+ end
+
+ def test_rhtml_and_rxml_not_exempt_from_layout
+ assert !@controller.send(:template_exempt_from_layout?, 'test.rhtml')
+ assert !@controller.send(:template_exempt_from_layout?, 'test.rxml')
+ end
+
+ def test_other_extension_not_exempt_from_layout
+ assert !@controller.send(:template_exempt_from_layout?, 'test.random')
+ end
+
+ def test_add_extension_to_exempt_from_layout
+ ['rpdf', :rpdf].each do |ext|
+ assert_nothing_raised do
+ ActionController::Base.exempt_from_layout ext
+ end
+ assert @controller.send(:template_exempt_from_layout?, "test.#{ext}")
+ end
+ end
+
+ def test_add_regexp_to_exempt_from_layout
+ ActionController::Base.exempt_from_layout /\.rdoc/
+ assert @controller.send(:template_exempt_from_layout?, 'test.rdoc')
+ end
+end
+
class DefaultLayoutController < LayoutTest
end