2016-03-07 19:52:19 -05:00
|
|
|
# frozen_string_literal: true
|
2018-01-08 15:23:54 -05:00
|
|
|
|
2011-02-03 17:18:07 -05:00
|
|
|
require 'rspec/core'
|
2017-03-28 13:41:49 -04:00
|
|
|
require 'capybara/dsl'
|
2011-02-11 08:03:46 -05:00
|
|
|
require 'capybara/rspec/matchers'
|
2011-02-11 08:44:58 -05:00
|
|
|
require 'capybara/rspec/features'
|
2017-03-28 13:41:49 -04:00
|
|
|
require 'capybara/rspec/matcher_proxies'
|
2010-12-10 08:54:46 -05:00
|
|
|
|
2010-12-21 10:25:25 -05:00
|
|
|
RSpec.configure do |config|
|
2018-01-09 17:05:50 -05:00
|
|
|
config.include Capybara::DSL, type: :feature
|
|
|
|
config.include Capybara::RSpecMatchers, type: :feature
|
|
|
|
config.include Capybara::RSpecMatchers, type: :view
|
2013-07-21 20:19:42 -04:00
|
|
|
|
2011-02-03 17:18:07 -05:00
|
|
|
# The before and after blocks must run instantaneously, because Capybara
|
|
|
|
# might not actually be used in all examples where it's included.
|
2010-12-10 08:54:46 -05:00
|
|
|
config.after do
|
2011-04-11 01:58:42 -04:00
|
|
|
if self.class.include?(Capybara::DSL)
|
2011-01-09 07:57:41 -05:00
|
|
|
Capybara.reset_sessions!
|
|
|
|
Capybara.use_default_driver
|
|
|
|
end
|
2010-12-10 08:54:46 -05:00
|
|
|
end
|
2017-03-28 13:41:49 -04:00
|
|
|
|
2018-05-15 15:39:40 -04:00
|
|
|
config.before do |example|
|
2011-04-11 01:58:42 -04:00
|
|
|
if self.class.include?(Capybara::DSL)
|
2013-07-20 15:27:28 -04:00
|
|
|
Capybara.current_driver = Capybara.javascript_driver if example.metadata[:js]
|
2013-07-21 00:11:46 -04:00
|
|
|
Capybara.current_driver = example.metadata[:driver] if example.metadata[:driver]
|
2011-01-09 07:57:41 -05:00
|
|
|
end
|
2010-12-10 08:54:46 -05:00
|
|
|
end
|
|
|
|
end
|