提交 1a09b6eb 编写于 作者: R Rafael França 提交者: Gannon McGibbon

Merge pull request #36691 from Edouard-chin/ec-system-test-route

Don't include routes helpers inside System test class:
上级 ea77dbff
......@@ -54,11 +54,5 @@ class Railtie < Rails::Railtie # :nodoc:
ActionDispatch.test_app = app
end
initializer "action_dispatch.system_tests" do |app|
ActiveSupport.on_load(:action_dispatch_system_test_case) do
include app.routes.url_helpers
end
end
end
end
......@@ -119,6 +119,11 @@ class SystemTestCase < ActiveSupport::TestCase
def initialize(*) # :nodoc:
super
self.class.driver.use
@proxy_route = if ActionDispatch.test_app
Class.new { include ActionDispatch.test_app.routes.url_helpers }.new
else
nil
end
end
def self.start_application # :nodoc:
......@@ -163,6 +168,14 @@ def url_options # :nodoc:
default_url_options.merge(host: Capybara.app_host)
end
def method_missing(method, *args, &block)
if @proxy_route.respond_to?(method)
@proxy_route.send(method, *args, &block)
else
super
end
end
ActiveSupport.run_load_hooks(:action_dispatch_system_test_case, self)
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册