c:/mowes/www/rails_projects/sample_app/spec/spec_helper.rb:4:in `block
in ‘: uninitialized constant Capybara (NameError)
投机/ spec_helper.rb
# This file is copied to spec/ when you run 'rails generate rspec:install' RSpec.configure do |config| config.include Capybara::DSL end
我的Gemfile中有宝石’capybara’,’2.1.0’所以我不知道发生了什么.
解决方法
我认为这可行.尝试在spec_helper.rb中添加这些行
RSpec.configure do |config| config.fixture_path = "#{::Rails.root}/spec/fixtures" config.use_transactional_fixtures = true config.infer_base_class_for_anonymous_controllers = false config.order = "random" config.include Capybara::DSL end