Merge pull request #36691 from Edouard-chin/ec-system-test-route
Don't include routes helpers inside System test class:
This commit is contained in:
commit
8d967534de
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user