RSpec 找不到 Cucumber gem
运行 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
好吧,我自己弄清楚了:
我正在运行的规范文件有一个“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.
嗯,你确实使用了 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.我在运行稍新的 gems 的 Windows XP 上遇到了同样的问题,但大多数环境与原始帖子相同。
这就是我所做的:
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:
伙计们,只需遵循 Wiki 说明即可。
Guys, just follow the Wiki instructions.