forked from eliotsykes/rails-testing-toolbox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcapybara_driver_resolver.rb
28 lines (20 loc) · 957 Bytes
/
capybara_driver_resolver.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# You probably don't need this config, its for setting up Capybara drivers
# with descriptive names related to the underlying browser's HTML5 support.
module CapybaraDriverResolver
FIREFOX_DRIVERS = [:selenium_billy, :selenium]
CHROME_DRIVERS = [:selenium_chrome_billy, :selenium_chrome_ssl]
PHANTOMJS_DRIVERS = [:poltergeist_billy, :poltergeist]
WITH_NATIVE_DATE_INPUT = PHANTOMJS_DRIVERS + CHROME_DRIVERS
WITHOUT_NATIVE_DATE_INPUT = FIREFOX_DRIVERS
def driver_with(options)
potential_drivers = options[:native_date_input] ? WITH_NATIVE_DATE_INPUT : WITHOUT_NATIVE_DATE_INPUT
potential_drivers.each do |driver|
return driver if Capybara.drivers[driver]
end
raise Capybara::DriverNotFoundError,
"no driver matching options #{options.inspect} was found, available drivers: #{Capybara.drivers.join(', ')}"
end
end
RSpec.configure do |config|
config.extend CapybaraDriverResolver, type: :feature
end