aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/layout_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/test/controller/layout_test.rb')
-rw-r--r--actionpack/test/controller/layout_test.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/actionpack/test/controller/layout_test.rb b/actionpack/test/controller/layout_test.rb
index 09283eddc9..f2721e274d 100644
--- a/actionpack/test/controller/layout_test.rb
+++ b/actionpack/test/controller/layout_test.rb
@@ -80,10 +80,21 @@ end
class DefaultLayoutController < LayoutTest
end
+class AbsolutePathLayoutController < LayoutTest
+ layout File.expand_path(File.expand_path(__FILE__) + '/../../fixtures/layout_tests/layouts/layout_test.rhtml')
+end
+
class HasOwnLayoutController < LayoutTest
layout 'item'
end
+class PrependsViewPathController < LayoutTest
+ def hello
+ prepend_view_path File.dirname(__FILE__) + '/../fixtures/layout_tests/alt/'
+ render :layout => 'alt'
+ end
+end
+
class OnlyLayoutController < LayoutTest
layout 'item', :only => "hello"
end
@@ -163,6 +174,20 @@ class LayoutSetInResponseTest < ActionController::TestCase
ensure
ActionController::Base.exempt_from_layout.delete(/\.rhtml$/)
end
+
+ def test_layout_is_picked_from_the_controller_instances_view_path
+ pending do
+ @controller = PrependsViewPathController.new
+ get :hello
+ assert_equal 'layouts/alt', @response.layout
+ end
+ end
+
+ def test_absolute_pathed_layout
+ @controller = AbsolutePathLayoutController.new
+ get :hello
+ assert_equal "layout_test.rhtml hello.rhtml", @response.body.strip
+ end
end
class RenderWithTemplateOptionController < LayoutTest