My Gemfile目前指定以下内容:
gem "rspec-expectations", "2.7.0"
当我尝试运行Cucumber时,我得到以下内容:
no such file to load -- rspec/expectations (LoadError)
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:36:in `require'
/Library/Ruby/Gems/1.8/gems/rspec-2.7.0/lib/rspec.rb:2
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:36:in `require'
/Users/rthomas/dev/companyname/ci/behavior_testing/features/support/env.rb:4
....
我正在使用的Gemfile指定v 2.7.0,所以我尝试更新它并重新运行Cucumber,我得到以下内容:
can't activate rspec-expectations (~> 2.7.0, runtime) for ["rspec-2.7.0"], already activated rspec-expectations-2.14.5 for [] (Gem::LoadError)
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:230:in `activate'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:246:in `activate'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:245:in `each'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:245:in `activate'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:35:in `require'
/Users/rthomas/dev/companyname/ci/behavior_testing/features/support/env.rb:4
....
显然,当我卸载2.7.0并使用最新的RSpec版本时,我得到了一个RubyGem版本错误。
我找到this post并尝试更新我的rspec-rails gem版本,但没有快乐。
我需要在我给出的Gemfile的约束下工作,所以有没有办法在使用2.7.0版本时修复初始错误(没有这样的文件加载 - rspec / expectations(LoadError)) ?
答案 0 :(得分:1)
找到this article,其中讨论了“diff-lcs”宝石。 OP安装了两个不同的版本,而较新的版本导致了冲突。我检查了我的Gemlist,发现我有一个正确的(v.1.1.3)和一个更新的(v 1.2.5),所以我只是卸载了更新的版本,我能够运行我的黄瓜测试。