Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #8582: per_request_view_paths_test.diff

File per_request_view_paths_test.diff, 1.1 kB (added by dasil003, 2 years ago)

The Test

  • actionpack/test/controller/view_paths_test.rb

    old new  
    77  class TestController < ActionController::Base 
    88    def self.controller_path() "test" end 
    99    def rescue_action(e) raise end 
    10        
     10     
     11    before_filter :add_view_path, :only => :hello_world_at_request_time 
     12     
    1113    def hello_world() end 
     14    def hello_world_at_request_time() render(:action => 'hello_world') end 
     15    private 
     16    def add_view_path 
     17      self.class.view_paths.unshift "#{LOAD_PATH_ROOT}/override" 
     18    end 
    1219  end 
    1320   
    1421  def setup 
     
    4451    assert_equal "Hello overridden world!", @response.body 
    4552  end 
    4653   
     54  def test_view_paths_override_at_request_time 
     55    get :hello_world_at_request_time 
     56    assert_response :success 
     57    assert_equal "Hello overridden world!", @response.body 
     58  end 
     59   
    4760  def test_template_root_deprecated 
    4861    assert_deprecated(/template_root.*view_paths/) do 
    4962      TestController.template_root = 'foo/bar'