rspec错误集锦

1  bundle exec rspec spec/时出现错误

undefined method `visit' for #<RSpec::Core::ExampleGroup::Nested_1::Nested_1:0xbabf1d4>

解决办法及原因(要先安装capybara并在gemfile中加上gem 'capybara')


This happens because you are trying use visit method from Capybara::DSL. If you check the documentation:

 Capybara is no longer supported in
 request specs as of Capybara 2.0.0. The recommended way to use Capybara is
 with feature specs.

For solve this problem you should move your tests to spec/features folder or include Capybara::DSL for request specs:

#spec_helper.rbRSpec.configure do |config|
  #...
  config.include Capybara::DSL, :type => :request

   


你可能感兴趣的:(rspec错误集锦)