gpt4 book ai didi

ruby-on-rails - 无法让 rake spec 工作

转载 作者:太空宇宙 更新时间:2023-11-03 16:34:21 28 4
gpt4 key购买 nike

我正在按照教程学习 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)

我多次发现这个问题是过时的 gem ,但我已经更新了所有 gem 和我的 Gemfile 以反射(reflect)这一点。

我知道“特征”是 capybara gem 的一种方法,用于匹配场景等。我在我的 spec/spec_helber.rb 文件中包含了 require('rspec/capybara')以及在我的 Gemfile 中。

我做错了什么!?

干杯,

~哈雷

最佳答案

改为尝试:

bundle exec rake spec

关于ruby-on-rails - 无法让 rake spec 工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10119905/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com