Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 26 lines (24 sloc) 0.864 kB
aa46894 Add RSpec support in Capybara itself, closes #187
Anders Törnqvist authored
1 require 'capybara'
2 require 'capybara/dsl'
558e7b2 @joliss Use the :request type for RSpec example groups
joliss authored
3 require 'rspec/core'
6fea34c @jnicklas Make RSpec matchers work with session and nodes
authored
4 require 'capybara/rspec_matchers'
aa46894 Add RSpec support in Capybara itself, closes #187
Anders Törnqvist authored
5
7abde02 @jnicklas Correct module name for RSpec, prevent deprecation warnings
authored
6 RSpec.configure do |config|
558e7b2 @joliss Use the :request type for RSpec example groups
joliss authored
7 config.include Capybara, :type => :request
bdde00a @jnicklas Only mix in Capybara into :type => :acceptance examples
authored
8 config.include Capybara, :type => :acceptance
558e7b2 @joliss Use the :request type for RSpec example groups
joliss authored
9 config.include Capybara::RSpecMatchers, :type => :request
6fea34c @jnicklas Make RSpec matchers work with session and nodes
authored
10 config.include Capybara::RSpecMatchers, :type => :acceptance
558e7b2 @joliss Use the :request type for RSpec example groups
joliss authored
11 # The before and after blocks must run instantaneously, because Capybara
12 # might not actually be used in all examples where it's included.
aa46894 Add RSpec support in Capybara itself, closes #187
Anders Törnqvist authored
13 config.after do
558e7b2 @joliss Use the :request type for RSpec example groups
joliss authored
14 if self.class.include?(Capybara)
bdde00a @jnicklas Only mix in Capybara into :type => :acceptance examples
authored
15 Capybara.reset_sessions!
16 Capybara.use_default_driver
17 end
aa46894 Add RSpec support in Capybara itself, closes #187
Anders Törnqvist authored
18 end
19 config.before do
558e7b2 @joliss Use the :request type for RSpec example groups
joliss authored
20 if self.class.include?(Capybara)
bdde00a @jnicklas Only mix in Capybara into :type => :acceptance examples
authored
21 Capybara.current_driver = Capybara.javascript_driver if example.metadata[:js]
22 Capybara.current_driver = example.metadata[:driver] if example.metadata[:driver]
23 end
aa46894 Add RSpec support in Capybara itself, closes #187
Anders Törnqvist authored
24 end
25 end
Something went wrong with that request. Please try again.