Rspec已经运行了一段时间但是我在运行任何rspec测试时突然遇到这个问题:
/Users/joseph/.rvm/gems/ruby-1.9.2-p180/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:437:in `require': no such file to load -- rspec/instafail (LoadError)
from /Users/joseph/.rvm/gems/ruby-1.9.2-p180/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:437:in `block in requires='
from /Users/joseph/.rvm/gems/ruby-1.9.2-p180/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:435:in `map'
from /Users/joseph/.rvm/gems/ruby-1.9.2-p180/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:435:in `requires='
from /Users/joseph/.rvm/gems/ruby-1.9.2-p180/gems/rspec-core-2.11.1/lib/rspec/core/configuration_options.rb:20:in `block in configure'
from /Users/joseph/.rvm/gems/ruby-1.9.2-p180/gems/rspec-core-2.11.1/lib/rspec/core/configuration_options.rb:19:in `each'
from /Users/joseph/.rvm/gems/ruby-1.9.2-p180/gems/rspec-core-2.11.1/lib/rspec/core/configuration_options.rb:19:in `configure'
from /Users/joseph/.rvm/gems/ruby-1.9.2-p180/gems/rspec-core-2.11.1/lib/rspec/core/command_line.rb:21:in `run'
from /Users/joseph/.rvm/gems/ruby-1.9.2-p180/gems/rspec-core-2.11.1/lib/rspec/core/runner.rb:66:in `rescue in run'
from /Users/joseph/.rvm/gems/ruby-1.9.2-p180/gems/rspec-core-2.11.1/lib/rspec/core/runner.rb:62:in `run'
from /Users/joseph/.rvm/gems/ruby-1.9.2-p180/gems/rspec-core-2.11.1/lib/rspec/core/runner.rb:8:in `block in autorun'
我通常会对项目进行一些检查(即git clone两次进入不同的目录)。出于某种原因,即使使用相同版本的代码,rspec也只会在我的一个检出中遇到此问题而不会遇到另一个问题。我最终通过创建另一个克隆来规避这个问题。由于某种原因,此问题再次出现,我不想继续创建克隆以避免此问题。有谁知道可能是什么根本原因?
答案 0 :(得分:2)
原来问题是像rspec-instafail这样的宝石被归为一个开发宝石。在过去的某个时候,我已经运行了“捆绑安装 - 没有开发”,显然随后的捆绑安装是自动完成的。结果,那些宝石不在我的$ LOAD_PATH上。
要修复它,我只是运行'bundle install --without asdf',因为没有'asdf'组,所以安装了所有的gem。可能有一个更合适的选项来重新添加这些组,但这对我有用。