提交 d78e3fe7 编写于 作者: C Carlhuda

Fix failing Action Pack tests

上级 9f83cdc3
...@@ -152,7 +152,7 @@ def _assigns ...@@ -152,7 +152,7 @@ def _assigns
end end
def method_missing(selector, *args) def method_missing(selector, *args)
if ActionDispatch::Routing::Routes.named_routes.helpers.include?(selector) if @controller._router.named_routes.helpers.include?(selector)
@controller.__send__(selector, *args) @controller.__send__(selector, *args)
else else
super super
......
...@@ -203,6 +203,16 @@ def assert_header(name, value) ...@@ -203,6 +203,16 @@ def assert_header(name, value)
class ::ApplicationController < ActionController::Base class ::ApplicationController < ActionController::Base
end end
module ActionView
class TestCase
# Must repeat the setup because AV::TestCase is a duplication
# of AC::TestCase
setup do
@router = SharedTestRoutes
end
end
end
module ActionController module ActionController
class Base class Base
include ActionController::Testing include ActionController::Testing
......
...@@ -17,9 +17,9 @@ def show ...@@ -17,9 +17,9 @@ def show
tests LogSubscriberController tests LogSubscriberController
def setup def setup
super
@old_logger = ActionController::Base.logger @old_logger = ActionController::Base.logger
Rails::LogSubscriber.add(:action_controller, ActionController::Railties::LogSubscriber.new) Rails::LogSubscriber.add(:action_controller, ActionController::Railties::LogSubscriber.new)
super
end end
def teardown def teardown
......
...@@ -40,6 +40,8 @@ class ACLogSubscriberTest < ActionController::TestCase ...@@ -40,6 +40,8 @@ class ACLogSubscriberTest < ActionController::TestCase
include Rails::LogSubscriber::TestHelper include Rails::LogSubscriber::TestHelper
def setup def setup
super
@old_logger = ActionController::Base.logger @old_logger = ActionController::Base.logger
@cache_path = File.expand_path('../temp/test_cache', File.dirname(__FILE__)) @cache_path = File.expand_path('../temp/test_cache', File.dirname(__FILE__))
...@@ -47,7 +49,6 @@ def setup ...@@ -47,7 +49,6 @@ def setup
ActionController::Base.cache_store = :file_store, @cache_path ActionController::Base.cache_store = :file_store, @cache_path
Rails::LogSubscriber.add(:action_controller, ActionController::Railties::LogSubscriber.new) Rails::LogSubscriber.add(:action_controller, ActionController::Railties::LogSubscriber.new)
super
end end
def teardown def teardown
......
...@@ -7,11 +7,11 @@ class AVLogSubscriberTest < ActiveSupport::TestCase ...@@ -7,11 +7,11 @@ class AVLogSubscriberTest < ActiveSupport::TestCase
include Rails::LogSubscriber::TestHelper include Rails::LogSubscriber::TestHelper
def setup def setup
super
@old_logger = ActionController::Base.logger @old_logger = ActionController::Base.logger
@view = ActionView::Base.new(ActionController::Base.view_paths, {}) @view = ActionView::Base.new(ActionController::Base.view_paths, {})
Rails.stubs(:root).returns(File.expand_path(FIXTURE_LOAD_PATH)) Rails.stubs(:root).returns(File.expand_path(FIXTURE_LOAD_PATH))
Rails::LogSubscriber.add(:action_view, ActionView::Railties::LogSubscriber.new) Rails::LogSubscriber.add(:action_view, ActionView::Railties::LogSubscriber.new)
super
end end
def teardown def teardown
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册