开发者

RSpec can't find Cucumber gem

开发者 https://www.devze.com 2022-12-19 04:38 出处:网络
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\'

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 &g开发者_运维百科t;= 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!


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.


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


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


Guys, just follow the Wiki instructions.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号