aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/view_paths_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/test/controller/view_paths_test.rb')
-rw-r--r--actionpack/test/controller/view_paths_test.rb15
1 files changed, 14 insertions, 1 deletions
diff --git a/actionpack/test/controller/view_paths_test.rb b/actionpack/test/controller/view_paths_test.rb
index d6d6dac4f3..c84ced5394 100644
--- a/actionpack/test/controller/view_paths_test.rb
+++ b/actionpack/test/controller/view_paths_test.rb
@@ -18,6 +18,11 @@ class ViewLoadPathsTest < Test::Unit::TestCase
end
end
+ class Test::SubController < ActionController::Base
+ layout 'test/sub'
+ def hello_world; render 'test/hello_world'; end
+ end
+
def setup
TestController.view_paths = [ LOAD_PATH_ROOT ]
@controller = TestController.new
@@ -27,7 +32,7 @@ class ViewLoadPathsTest < Test::Unit::TestCase
# Track the last warning.
@old_behavior = ActiveSupport::Deprecation.behavior
@last_message = nil
- ActiveSupport::Deprecation.behavior = Proc.new { |message| @last_message = message }
+ ActiveSupport::Deprecation.behavior = Proc.new { |message, callback| @last_message = message }
end
def teardown
@@ -51,6 +56,14 @@ class ViewLoadPathsTest < Test::Unit::TestCase
assert_equal "Hello overridden world!", @response.body
end
+ def test_view_paths_override_for_layouts_in_controllers_with_a_module
+ @controller = Test::SubController.new
+ Test::SubController.view_paths = [ "#{LOAD_PATH_ROOT}/override", LOAD_PATH_ROOT, "#{LOAD_PATH_ROOT}/override2" ]
+ get :hello_world
+ assert_response :success
+ assert_equal "layout: Hello overridden world!", @response.body
+ end
+
def test_view_paths_override_at_request_time
get :hello_world_at_request_time
assert_response :success