官方文档如下:
https://github.com/rspec/rspec-rails/blob/master/Capybara.md
Capybara 2.0
To use Capybara 2.0, you need rspec-rails-2.11.1 or greater.
Capybara::DSL is added to examples in:
- spec/features
Capybara::RSpecMatchers is added to examples in:
- spec/features
- spec/controllers
- spec/views
- spec/helpers
- spec/mailers
问题原因:Capybara2.0以后,集成测试的目录变了
解决方案为:默认生成的RSpec集成测试目录为requests目录,改为features目录即可解决问题