Skip to content

Commit

Permalink
Follow up refactor for #2746 moving default driver to constant
Browse files Browse the repository at this point in the history
  • Loading branch information
JonRowe committed Mar 19, 2024
1 parent c2a7b82 commit 5659af9
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions lib/rspec/rails/example/system_example_group.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,13 @@ def app
::Rails.application
end

DEFAULT_DRIVER =
if ::Rails::VERSION::STRING.to_f >= 7.2
:selenium_chrome_headless
else
:selenium
end

included do |other|
ActiveSupport.on_load(:action_dispatch_system_test_case) do
ActionDispatch::SystemTesting::Server.silence_puma = true
Expand Down Expand Up @@ -137,11 +144,7 @@ def initialize(*args, &blk)
self.class.before do
# A user may have already set the driver, so only default if driver
# is not set
if ::Rails::VERSION::STRING.to_f >= 7.2
driven_by(:selenium_chrome_headless) unless @driver
else
driven_by(:selenium) unless @driver
end
driven_by(DEFAULT_DRIVER) unless @driver
end
end

Expand Down

0 comments on commit 5659af9

Please sign in to comment.