在我的spec_helper.rb中,我有:
RSpec.configure do |config|
config.include Capybara::DSL
然后我正在跑步:
bundle exec rspec spec/requests/static_pages_spec.rb
******-C02MGBVJFD57:myapp ********$ bundle exec rspec spec/requests/static_pages_spec.rb
/Users/*********/workspace/myapp/spec/spec_helper.rb:18:in `block in <top (required)>': uninitialized constant Capybara (NameError)
为什么我收到此错误,我该如何解决?谢谢
答案 0 :(得分:6)
您需要加入capybara
gem。
您可以在Gemfile中添加它并运行bundle install
。
gem 'capybara'
之后在您的帮助文件中包含以下内容:
require 'capybara'
require 'capybara/dsl'