Skip to content

Commit 0c2b2d9

Browse files
committed
include Capybara::DSL and Capybara::RSpecMatchers in spec/features
- See teamcapybara/capybara#809
1 parent fb2f6f1 commit 0c2b2d9

File tree

1 file changed

+18
-12
lines changed

1 file changed

+18
-12
lines changed

lib/rspec/rails/vendor/capybara.rb

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,26 @@
88
rescue LoadError
99
end
1010

11-
RSpec.configure do |c|
12-
if defined?(Capybara::RSpecMatchers)
13-
c.include Capybara::RSpecMatchers, :type => :view
14-
c.include Capybara::RSpecMatchers, :type => :helper
15-
c.include Capybara::RSpecMatchers, :type => :mailer
16-
c.include Capybara::RSpecMatchers, :type => :controller
17-
end
11+
if defined?(Capybara)
12+
RSpec.configure do |c|
13+
if defined?(Capybara::DSL)
14+
c.include Capybara::DSL, :type => :controller
15+
c.include Capybara::DSL, :example_group => {
16+
:file_path => c.escaped_path(%w[spec features])
17+
}
18+
end
1819

19-
if defined?(Capybara::DSL)
20-
c.include Capybara::DSL, :type => :controller
21-
end
20+
if defined?(Capybara::RSpecMatchers)
21+
c.include Capybara::RSpecMatchers, :type => :view
22+
c.include Capybara::RSpecMatchers, :type => :helper
23+
c.include Capybara::RSpecMatchers, :type => :mailer
24+
c.include Capybara::RSpecMatchers, :type => :controller
25+
c.include Capybara::RSpecMatchers, :example_group => {
26+
:file_path => c.escaped_path(%w[spec features])
27+
}
28+
end
2229

23-
unless defined?(Capybara::RSpecMatchers) || defined?(Capybara::DSL)
24-
if defined?(Capybara)
30+
unless defined?(Capybara::RSpecMatchers) || defined?(Capybara::DSL)
2531
c.include Capybara, :type => :request
2632
c.include Capybara, :type => :controller
2733
end

0 commit comments

Comments
 (0)