aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
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