RSpec找不到黄瓜宝石

时间:2010-02-07 01:50:35

标签: ruby-on-rails rubygems rspec cucumber

运行rspec时出现以下错误:

no such file to load -- cucumber-rails
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:158:in `require'
/usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/gem_dependency.rb:208:in `load'
/usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:307:in `load_gems'
/usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:307:in `each'
/usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:307:in `load_gems'
/usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:169:in `process'
/usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in `send'
/usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in `run'
/home/amurmann/NetBeansProjects/demandserver/config/environment.rb:10
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in `new_constants_in'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
./spec/helpers/../spec_helper.rb:6
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
./spec/helpers/profiles_helper_spec.rb:1
/usr/lib/ruby/gems/1.8/gems/rspec-1.3.0/lib/spec/runner/example_group_runner.rb:15:in `load'
/usr/lib/ruby/gems/1.8/gems/rspec-1.3.0/lib/spec/runner/example_group_runner.rb:15:in `load_files'
/usr/lib/ruby/gems/1.8/gems/rspec-1.3.0/lib/spec/runner/example_group_runner.rb:14:in `each'
/usr/lib/ruby/gems/1.8/gems/rspec-1.3.0/lib/spec/runner/example_group_runner.rb:14:in `load_files'
/usr/lib/ruby/gems/1.8/gems/rspec-1.3.0/lib/spec/runner/options.rb:133:in `run_examples'
/usr/lib/ruby/gems/1.8/gems/rspec-1.3.0/lib/spec/runner/command_line.rb:9:in `run'
/usr/lib/ruby/gems/1.8/gems/rspec-1.3.0/bin/spec:5
/usr/bin/spec:19:in `load'
/usr/bin/spec:19
Missing these required gems:
  cucumber-rails  

You're running:
  ruby 1.8.7.174 at /usr/bin/ruby1.8
  rubygems 1.3.5 at /home/amurmann/.gem/ruby/1.8, /usr/lib/ruby/gems/1.8

Run `rake gems:install` to install the missing gems.

我设置了测试environemnt以要求rspec,rspec-rails以及黄瓜。这些都已安装:

 - [F] has_many_polymorphs 
    - [R] activerecord 
 - [I] rspec >= 1.2.0
 - [I] rspec-rails >= 1.2.0
    - [I] rspec >= 1.3.0
    - [R] rack >= 1.0.0
 - [I] factory_girl 
 - [I] webrat >= 0.4.3
    - [I] nokogiri >= 1.2.0
    - [R] rack >= 1.0
    - [I] rack-test >= 0.5.3
       - [R] rack >= 1.0
 - [I] cucumber-rails 
    - [I] cucumber >= 0.6.2
       - [I] term-ansicolor >= 1.0.4
       - [I] treetop >= 1.4.2
          - [I] polyglot >= 0.2.5
       - [I] polyglot >= 0.2.9
       - [R] builder >= 2.1.2
       - [I] diff-lcs >= 1.1.2
       - [I] json_pure >= 1.2.0
 - [I] database_cleaner >= 0.4.3

I = Installed
F = Frozen
R = Framework (loaded before rails starts)

我已经重新安装了黄瓜和rspec,但错误仍然存​​在。

非常感谢您的帮助!

4 个答案:

答案 0 :(得分:1)

好的,我自己弄清楚了:

我运行的spec文件有一个“require'granner_rails'”。我不知道是否以及为什么我把它放在那里或者是否被某些脚本放在那里。我删除了这个,现在一切正常。

我不确定为什么这会引起问题,但现在可行了。如果有人知道为什么会造成麻烦,我会很高兴解释一下。

答案 1 :(得分:0)

嗯,您确实使用sudo gem install cucumber-rails来安装宝石吗?有时会抛出'东西'。

答案 2 :(得分:0)

我在运行稍微更新的宝石的Windows XP上遇到了同样的问题,但大部分环境与原始帖子相同。

这就是我所做的:

  1. 尝试取消注释config.gem cucumber
  2. 如果你有config.gem黄瓜,请使用:lib =>假

答案 3 :(得分:-2)

伙计们,只需按照Wiki instructions