From 7f517348db260fb0794a3644f761ac91fe540472 Mon Sep 17 00:00:00 2001 From: Rick Olson Date: Fri, 15 Jun 2007 23:52:37 +0000 Subject: Make ActionView#view_paths an attr_accessor for real this time. Also, don't perform an unnecessary #compact on the @view_paths array in #initialize. Closes #8582 [dasil003, julik, rick] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7034 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/test/controller/view_paths_test.rb | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'actionpack/test') diff --git a/actionpack/test/controller/view_paths_test.rb b/actionpack/test/controller/view_paths_test.rb index 6c07c40c0a..d6d6dac4f3 100644 --- a/actionpack/test/controller/view_paths_test.rb +++ b/actionpack/test/controller/view_paths_test.rb @@ -7,8 +7,15 @@ class ViewLoadPathsTest < Test::Unit::TestCase class TestController < ActionController::Base def self.controller_path() "test" end def rescue_action(e) raise end - + + before_filter :add_view_path, :only => :hello_world_at_request_time + def hello_world() end + def hello_world_at_request_time() render(:action => 'hello_world') end + private + def add_view_path + self.class.view_paths.unshift "#{LOAD_PATH_ROOT}/override" + end end def setup @@ -44,6 +51,12 @@ class ViewLoadPathsTest < Test::Unit::TestCase assert_equal "Hello overridden world!", @response.body end + def test_view_paths_override_at_request_time + get :hello_world_at_request_time + assert_response :success + assert_equal "Hello overridden world!", @response.body + end + def test_template_root_deprecated assert_deprecated(/template_root.*view_paths/) do TestController.template_root = 'foo/bar' -- cgit v1.2.3