From 1d8466c38804a555df58ebe214c9aa0e240ad856 Mon Sep 17 00:00:00 2001 From: eileencodes Date: Tue, 21 Feb 2017 11:02:39 -0500 Subject: Only load SystemTestCase if Capybara is defined For applications that are upgrading or applications that are choosing to skip system testing Capbyara will not be available. SystemTestCase and friends shoud only be loaded if Capbyara is defined. Fixes #28094 --- railties/lib/rails/test_help.rb | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'railties') diff --git a/railties/lib/rails/test_help.rb b/railties/lib/rails/test_help.rb index 75171f2395..09931c108a 100644 --- a/railties/lib/rails/test_help.rb +++ b/railties/lib/rails/test_help.rb @@ -7,11 +7,14 @@ require "active_support/test_case" require "action_controller" require "action_controller/test_case" require "action_dispatch/testing/integration" -require "action_dispatch/system_test_case" require "rails/generators/test_case" require "active_support/testing/autorun" +if defined?(Capbyara) + require "action_dispatch/system_test_case" +end + if defined?(ActiveRecord::Base) ActiveRecord::Migration.maintain_test_schema! @@ -46,9 +49,11 @@ class ActionDispatch::IntegrationTest end end -class ActionDispatch::SystemTestCase - def before_setup # :nodoc: - @routes = Rails.application.routes - super +if defined? Capybara + class ActionDispatch::SystemTestCase + def before_setup # :nodoc: + @routes = Rails.application.routes + super + end end end -- cgit v1.2.3