1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

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

View file

@ -10,11 +10,16 @@ module ActionView
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

View file

@ -112,7 +112,7 @@ module ActionView
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 @@ module ActionView
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')