aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorSven Fuchs <svenfuchs@artweb-design.de>2009-02-20 14:19:45 -0600
committerJoshua Peek <josh@joshpeek.com>2009-02-20 14:19:45 -0600
commit8c5cc66a831aadb159f3daaffa4208064c30af0e (patch)
tree7ffe5f96ae923aa21aad4a2c6ab85d41d694e16e /actionpack/test
parent01c818e99f04f70462df68e6a217dfd280c37581 (diff)
downloadrails-8c5cc66a831aadb159f3daaffa4208064c30af0e.tar.gz
rails-8c5cc66a831aadb159f3daaffa4208064c30af0e.tar.bz2
rails-8c5cc66a831aadb159f3daaffa4208064c30af0e.zip
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 <josh@joshpeek.com>
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/controller/layout_test.rb14
-rw-r--r--actionpack/test/fixtures/layout_tests/alt/layouts/alt.rhtml0
2 files changed, 14 insertions, 0 deletions
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
--- /dev/null
+++ b/actionpack/test/fixtures/layout_tests/alt/layouts/alt.rhtml