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

30 lines
991 B
Ruby
Raw Normal View History

require 'capybara'
require 'capybara/dsl'
require 'rspec/core'
2011-02-11 08:03:46 -05:00
require 'capybara/rspec/matchers'
require 'capybara/rspec/features'
RSpec.configure do |config|
2012-09-07 14:17:38 -04:00
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
if self.class.include?(Capybara::DSL)
Capybara.current_driver = Capybara.javascript_driver if example.metadata[:js]
Capybara.current_driver = example.metadata[:driver] if example.metadata[:driver]
end
end
end
# Override default rack_test driver to respect data-method attributes.
Capybara.register_driver :rack_test do |app|
Capybara::RackTest::Driver.new(app, :respect_data_method => true)
end