Skip to content

Commit

Permalink
fix: autoload capybara
Browse files Browse the repository at this point in the history
  • Loading branch information
KonnorRogers committed Sep 27, 2022
1 parent 735c055 commit 7e25d8e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
10 changes: 9 additions & 1 deletion lib/evil_systems.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ module EvilSystems
# @see RegisterCuprite#initial_setup
# @see PrecompileAssets#initial_setup
def self.initial_setup(task: "assets:precompile", silent: true, skip_task: false, driver_options: {})
require "capybara"
Settings.initial_setup
RegisterCuprite.initial_setup(driver_options: driver_options)

Expand All @@ -21,4 +22,11 @@ def self.initial_setup(task: "assets:precompile", silent: true, skip_task: false
end
end

require "evil_systems/engine" if defined?(Rails)

begin
require "rails"
require "evil_systems/engine"
rescue LoadError
# no-op. Not in a rails env.
end

7 changes: 6 additions & 1 deletion lib/evil_systems/register_cuprite.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ module RegisterCuprite
# The initial setup prior to the class ApplicationSystemTestCase, runs before the entire test suite.
# @return [void]
def self.initial_setup(driver_options: {})
return unless defined? Capybara::Cuprite
begin
require "capybara"
require "capybara/cuprite"
rescue LoadError
return
end

begin
process_timeout = Integer(ENV.fetch("PROCESS_TIMEOUT", 5))
Expand Down

0 comments on commit 7e25d8e

Please sign in to comment.