diff --git a/actionpack/lib/action_view/test_case.rb b/actionpack/lib/action_view/test_case.rb index 2c66e5ae09..e71761db6d 100644 --- a/actionpack/lib/action_view/test_case.rb +++ b/actionpack/lib/action_view/test_case.rb @@ -10,11 +10,16 @@ class TestController < ActionController::Base attr_accessor :request, :response, :params - def self.controller_path - '' + class << self + attr_writer :controller_path + end + + def controller_path=(path) + self.class.controller_path=(path) end def initialize + self.class.controller_path = "" @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new diff --git a/actionpack/test/template/test_case_test.rb b/actionpack/test/template/test_case_test.rb index a4fb9f22bf..25dbc04ce1 100644 --- a/actionpack/test/template/test_case_test.rb +++ b/actionpack/test/template/test_case_test.rb @@ -112,7 +112,7 @@ def render_from_helper end end - TestController.stubs(:controller_path).returns('test') + @controller.controller_path = 'test' @customers = [stub(:name => 'Eloy'), stub(:name => 'Manfred')] assert_match /Hello: EloyHello: Manfred/, render(:partial => 'test/from_helper') @@ -161,7 +161,7 @@ def render_from_helper end test "is able to render partials from templates and also use instance variables" do - TestController.stubs(:controller_path).returns('test') + @controller.controller_path = "test" @customers = [stub(:name => 'Eloy'), stub(:name => 'Manfred')] assert_match /Hello: EloyHello: Manfred/, render(:file => 'test/list')