Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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>
  • Loading branch information...
commit 163152bfd0ea5344472d24b6f89e8c957dbd66f5 1 parent e3549a8
@dchelimsky dchelimsky authored josevalim committed
View
9 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
View
4 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')
Please sign in to comment.
Something went wrong with that request. Please try again.