1
0
Fork 0
mirror of https://github.com/teamcapybara/capybara.git synced 2022-11-09 12:08:07 -05:00
teamcapybara--capybara/lib/capybara/rspec.rb
Thomas Holmes 2a95252f8a Make Rspec 3 compliant
Change explicit use of `example` variable to using the block value that
is passed in to examples and before/after hooks.
2013-07-20 14:09:51 -04:00

24 lines
802 B
Ruby

require 'capybara'
require 'capybara/dsl'
require 'rspec/core'
require 'capybara/rspec/matchers'
require 'capybara/rspec/features'
RSpec.configure do |config|
config.include Capybara::DSL, :type => :feature
config.include Capybara::RSpecMatchers, :type => :feature
# The before and after blocks must run instantaneously, because Capybara
# might not actually be used in all examples where it's included.
config.after do
if self.class.include?(Capybara::DSL)
Capybara.reset_sessions!
Capybara.use_default_driver
end
end
config.before do |example|
if self.class.include?(Capybara::DSL)
Capybara.current_driver = Capybara.javascript_driver if ex.metadata[:js]
ampleCapybara.current_driver = ex.metadata[:driver] if ex.metadata[:driver]
end
end
end