Support configuration of controller.controller_path on instances of

ActionView::TestCase::TestController without stubs. Just say:

  @controller.controller_path = "path/i/need/for/this/test"

[#4697 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
This commit is contained in:
David Chelimsky 2010-05-25 00:34:55 -05:00 committed by José Valim
parent e3549a8054
commit 163152bfd0
2 changed files with 9 additions and 4 deletions

@ -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

@ -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')