我正在学习Ruby + Rails的教程,并且无法让rspec为我工作。
http://rubysource.com/rails-deep-dive-loccasions-home-page/
我接受'我们的第一次测试',当我运行rake spec
时,我收到以下错误:
harley-alexanders-macbook-pro:loccasions Harley$ rake spec
/Users/Harley/.rvm/rubies/ruby-1.9.3-p0/bin/ruby -S rspec ./spec/acceptance/home_page_spec.rb
/Users/Harley/.rvm/gems/ruby-1.9.3-p0@loccasions/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:251:in `require': cannot load such file -- rspec/capybara (LoadError)
from /Users/Harley/.rvm/gems/ruby-1.9.3-p0@loccasions/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:251:in `block in require'
from /Users/Harley/.rvm/gems/ruby-1.9.3-p0@loccasions/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:236:in `load_dependency'
from /Users/Harley/.rvm/gems/ruby-1.9.3-p0@loccasions/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:251:in `require'
from /Users/Harley/Sites/rails/loccasions/spec/spec_helper.rb:6:in `<top (required)>'
from /Users/Harley/Sites/rails/loccasions/spec/acceptance/home_page_spec.rb:1:in `require'
from /Users/Harley/Sites/rails/loccasions/spec/acceptance/home_page_spec.rb:1:in `<top (required)>'
from /Users/Harley/.rvm/gems/ruby-1.9.3-p0@loccasions/gems/rspec-core-2.9.0/lib/rspec/core/configuration.rb:746:in `load'
from /Users/Harley/.rvm/gems/ruby-1.9.3-p0@loccasions/gems/rspec-core-2.9.0/lib/rspec/core/configuration.rb:746:in `block in load_spec_files'
from /Users/Harley/.rvm/gems/ruby-1.9.3-p0@loccasions/gems/rspec-core-2.9.0/lib/rspec/core/configuration.rb:746:in `map'
from /Users/Harley/.rvm/gems/ruby-1.9.3-p0@loccasions/gems/rspec-core-2.9.0/lib/rspec/core/configuration.rb:746:in `load_spec_files'
from /Users/Harley/.rvm/gems/ruby-1.9.3-p0@loccasions/gems/rspec-core-2.9.0/lib/rspec/core/command_line.rb:22:in `run'
from /Users/Harley/.rvm/gems/ruby-1.9.3-p0@loccasions/gems/rspec-core-2.9.0/lib/rspec/core/runner.rb:69:in `run'
from /Users/Harley/.rvm/gems/ruby-1.9.3-p0@loccasions/gems/rspec-core-2.9.0/lib/rspec/core/runner.rb:10:in `block in autorun'
rake aborted!
/Users/Harley/.rvm/rubies/ruby-1.9.3-p0/bin/ruby -S rspec ./spec/acceptance/home_page_spec.rb failed
Tasks: TOP => spec
(See full trace by running task with --trace)
我多次发现这个问题已经过时了,但是我已经更新了所有这些以及我的Gemfile以反映这一点。
我知道'feature'是一种用于匹配场景等的capybara-gem的方法。我在我的spec / spec_helber.rb文件中包含require('rspec/capybara')
以及将它放在我的Gemfile中。< / p>
我做错了什么!?
干杯,
〜哈利
答案 0 :(得分:1)
尝试改为:
bundle exec rake spec