From 8c5cc66a831aadb159f3daaffa4208064c30af0e Mon Sep 17 00:00:00 2001 From: Sven Fuchs Date: Fri, 20 Feb 2009 14:19:45 -0600 Subject: make action_controller/layouts pick templates from the current instance's view_paths instead of the class view_paths [#1974 state:resolved] Signed-off-by: Joshua Peek --- actionpack/test/controller/layout_test.rb | 14 ++++++++++++++ .../test/fixtures/layout_tests/alt/layouts/alt.rhtml | 0 2 files changed, 14 insertions(+) create mode 100644 actionpack/test/fixtures/layout_tests/alt/layouts/alt.rhtml (limited to 'actionpack/test') diff --git a/actionpack/test/controller/layout_test.rb b/actionpack/test/controller/layout_test.rb index 2f5e830fba..28555ee3d1 100644 --- a/actionpack/test/controller/layout_test.rb +++ b/actionpack/test/controller/layout_test.rb @@ -83,6 +83,13 @@ 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 SetsLayoutInRenderController < LayoutTest def hello render :layout => 'third_party_template_library' @@ -130,6 +137,12 @@ class LayoutSetInResponseTest < ActionController::TestCase ensure ActionController::Base.exempt_from_layout.delete(/\.rhtml$/) end + + def test_layout_is_picked_from_the_controller_instances_view_path + @controller = PrependsViewPathController.new + get :hello + assert_equal 'layouts/alt', @response.layout + end end class RenderWithTemplateOptionController < LayoutTest @@ -178,3 +191,4 @@ unless RUBY_PLATFORM =~ /(:?mswin|mingw|bccwin)/ end end end + diff --git a/actionpack/test/fixtures/layout_tests/alt/layouts/alt.rhtml b/actionpack/test/fixtures/layout_tests/alt/layouts/alt.rhtml new file mode 100644 index 0000000000..e69de29bb2 -- cgit v1.2.3