Skip to content

Commit 5659af9

Browse files
committed
Follow up refactor for #2746 moving default driver to constant
1 parent c2a7b82 commit 5659af9

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

lib/rspec/rails/example/system_example_group.rb

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,13 @@ def app
9595
::Rails.application
9696
end
9797

98+
DEFAULT_DRIVER =
99+
if ::Rails::VERSION::STRING.to_f >= 7.2
100+
:selenium_chrome_headless
101+
else
102+
:selenium
103+
end
104+
98105
included do |other|
99106
ActiveSupport.on_load(:action_dispatch_system_test_case) do
100107
ActionDispatch::SystemTesting::Server.silence_puma = true
@@ -137,11 +144,7 @@ def initialize(*args, &blk)
137144
self.class.before do
138145
# A user may have already set the driver, so only default if driver
139146
# is not set
140-
if ::Rails::VERSION::STRING.to_f >= 7.2
141-
driven_by(:selenium_chrome_headless) unless @driver
142-
else
143-
driven_by(:selenium) unless @driver
144-
end
147+
driven_by(DEFAULT_DRIVER) unless @driver
145148
end
146149
end
147150

0 commit comments

Comments
 (0)