Permalink
Browse files

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
  • Loading branch information...
eileencodes committed Feb 21, 2017
1 parent 658b524 commit 1d8466c38804a555df58ebe214c9aa0e240ad856
Showing with 10 additions and 5 deletions.
  1. +10 −5 railties/lib/rails/test_help.rb
@@ -7,11 +7,14 @@
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 @@ def before_setup # :nodoc:
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

0 comments on commit 1d8466c

Please sign in to comment.