diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2019-07-17 15:11:53 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-17 15:11:53 -0400 |
commit | 8d967534de4df1a5e487c0ff2f948e138fd883cb (patch) | |
tree | 3e6b1575b20cf375a6ddfefdc3f56bbfd98f4cd4 /actionpack | |
parent | 6a50498618c2b9a316c3b28f6cb45bdaa70726ad (diff) | |
parent | 2dbb904c5ef97799908a746c54d2997538aa2906 (diff) | |
download | rails-8d967534de4df1a5e487c0ff2f948e138fd883cb.tar.gz rails-8d967534de4df1a5e487c0ff2f948e138fd883cb.tar.bz2 rails-8d967534de4df1a5e487c0ff2f948e138fd883cb.zip |
Merge pull request #36691 from Edouard-chin/ec-system-test-route
Don't include routes helpers inside System test class:
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_dispatch/railtie.rb | 6 | ||||
-rw-r--r-- | actionpack/lib/action_dispatch/system_test_case.rb | 13 |
2 files changed, 13 insertions, 6 deletions
diff --git a/actionpack/lib/action_dispatch/railtie.rb b/actionpack/lib/action_dispatch/railtie.rb index 66f90980b9..2e09aed41d 100644 --- a/actionpack/lib/action_dispatch/railtie.rb +++ b/actionpack/lib/action_dispatch/railtie.rb @@ -54,11 +54,5 @@ module ActionDispatch 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 diff --git a/actionpack/lib/action_dispatch/system_test_case.rb b/actionpack/lib/action_dispatch/system_test_case.rb index 29864c0f8e..9772beb8aa 100644 --- a/actionpack/lib/action_dispatch/system_test_case.rb +++ b/actionpack/lib/action_dispatch/system_test_case.rb @@ -119,6 +119,11 @@ module ActionDispatch 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 @@ module ActionDispatch 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 |