RSpec 找不到 Cucumber gem

发布于 2024-08-20 08:17:38 字数 3405 浏览 3 评论 0原文

运行 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.

我将测试环境设置为需要 rspec、rspec-rails 以及 cucumber。这些都已安装:

 - [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)

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

非常感谢您的帮助!

When running rspec I get the following error:

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.

I set up the test environemnt to require rspec, rspec-rails as well as cucumber. These are all installed:

 - [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)

I already reinstalled both cucumber and rspec, but the error persists.

Thank you very much for any help!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

意中人 2024-08-27 08:17:38

好吧,我自己弄清楚了:

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

我不确定为什么这会导致问题,但现在它可以工作了。如果有人知道为什么这会引起麻烦,我会很高兴得到解释。

OK, I figured it out myself:

The spec file I was running had a "require 'cucumber_rails'". I don't know if and why I put that there or if it was put there by some script. I removed this and now everything works.

I am not sure why this caused a problem, but now it works. If someone knows why this causes trouble, I would be happy about an explanation.

[浮城] 2024-08-27 08:17:38

嗯,你确实使用了 sudo gem install cucumber-rails 来安装 gem,对吗?有时这会导致“东西”丢失。

hmm, you did use sudo gem install cucumber-rails to install the gem right? Sometimes that throws 'stuff' off.

给妤﹃绝世温柔 2024-08-27 08:17:38

我在运行稍新的 gems 的 Windows XP 上遇到了同样的问题,但大多数环境与原始帖子相同。

这就是我所做的:

  1. 尝试取消注释 config.gem cucumber
  2. 如果您有 config.gem cucumber,请使用 :lib =>错误的

I was having the same problem on Windows XP running slightly newer gems, but most of the environment is same as the original post.

This is what I did:

  1. Try uncommenting config.gem cucumber
  2. If you have config.gem cucumber, use :lib => false
情绪 2024-08-27 08:17:38

伙计们,只需遵循 Wiki 说明即可。

Guys, just follow the Wiki instructions.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文