environment/cucumber.rb:
...
# gem dependencies
config.gem 'cucumber-rails', :lib => false, :version => '>=0.3.0' unless File.directory?(File.join(Rails.root, 'vend
config.gem 'database_cleaner', :lib => false, :version => '>=0.5.0' unless File.directory?(File.join(Rails.root, 'vend
config.gem 'webrat', :lib => false, :version => '>=0.7.0' unless File.directory?(File.join(Rails.root, 'vend
config.gem 'spork', :lib => false, :version => '>=0.7.5' unless File.directory?(File.join(Rails.root, 'vend
config.gem 'factory_girl', :source => 'http://gemcutter.org'
config.gem 'selenium-client', :lib => false
config.gem 'Selenium', :lib => false
config.gem 'rspec', :lib => 'spec'
config.gem 'rspec-rails', :lib => 'spec/rails'
config.gem 'test-unit', :lib => false
运行 Cucumber 时出现了缺少 gem 的错误:
artem:~/projects/food4feed (master)$ cucumber
...
no such file to load -- Selenium
/home/artem/.rvm/gems/ruby-1.9.1-p378/gems/polyglot-0.3.0/lib/polyglot.rb:65:in `require'
/home/artem/.rvm/gems/ruby-1.9.1-p378/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:158:in `require'
/home/artem/.rvm/gems/ruby-1.9.1-p378/gems/rspec-rails-1.3.2/lib/spec/rails.rb:13:in `<top (required)>'
/home/artem/.rvm/gems/ruby-1.9.1-p378/gems/polyglot-0.3.0/lib/polyglot.rb:65:in `require'
/home/artem/.rvm/gems/ruby-1.9.1-p378/gems/polyglot-0.3.0/lib/polyglot.rb:65:in `require'
/home/artem/.rvm/gems/ruby-1.9.1-p378/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:158:in `require'
/home/artem/.rvm/gems/ruby-1.9.1-p378/gems/rails-2.3.5/lib/rails/gem_dependency.rb:208:in `load'
/home/artem/.rvm/gems/ruby-1.9.1-p378/gems/rails-2.3.5/lib/initializer.rb:307:in `block in load_gems'
/home/artem/.rvm/gems/ruby-1.9.1-p378/gems/rails-2.3.5/lib/initializer.rb:307:in `each'
/home/artem/.rvm/gems/ruby-1.9.1-p378/gems/rails-2.3.5/lib/initializer.rb:307:in `load_gems'
/home/artem/.rvm/gems/ruby-1.9.1-p378/gems/rails-2.3.5/lib/initializer.rb:169:in `process'
/home/artem/.rvm/gems/ruby-1.9.1-p378/gems/rails-2.3.5/lib/initializer.rb:113:in `run'
/home/artem/projects/food4feed/config/environment.rb:9:in `<top (required)>'
/home/artem/.rvm/gems/ruby-1.9.1-p378/gems/polyglot-0.3.0/lib/polyglot.rb:65:in `require'
/home/artem/.rvm/gems/ruby-1.9.1-p378/gems/polyglot-0.3.0/lib/polyglot.rb:65:in `require'
/home/artem/projects/food4feed/features/support/env.rb:12:in `block in <top (required)>'
/home/artem/.rvm/gems/ruby-1.9.1-p378/gems/spork-0.8.1/lib/spork.rb:23:in `prefork'
/home/artem/projects/food4feed/features/support/env.rb:10:in `<top (required)>'
/home/artem/.rvm/gems/ruby-1.9.1-p378/gems/polyglot-0.3.0/lib/polyglot.rb:65:in `require'
/home/artem/.rvm/gems/ruby-1.9.1-p378/gems/polyglot-0.3.0/lib/polyglot.rb:65:in `require'
/home/artem/.rvm/gems/ruby-1.9.1-p378/gems/cucumber-0.6.3/lib/cucumber/rb_support/rb_language.rb:124:in `load_code_file'
/home/artem/.rvm/gems/ruby-1.9.1-p378/gems/cucumber-0.6.3/lib/cucumber/step_mother.rb:85:in `load_code_file'
/home/artem/.rvm/gems/ruby-1.9.1-p378/gems/cucumber-0.6.3/lib/cucumber/step_mother.rb:77:in `block in load_code_files'
/home/artem/.rvm/gems/ruby-1.9.1-p378/gems/cucumber-0.6.3/lib/cucumber/step_mother.rb:76:in `each'
/home/artem/.rvm/gems/ruby-1.9.1-p378/gems/cucumber-0.6.3/lib/cucumber/step_mother.rb:76:in `load_code_files'
/home/artem/.rvm/gems/ruby-1.9.1-p378/gems/cucumber-0.6.3/lib/cucumber/cli/main.rb:48:in `execute!'
/home/artem/.rvm/gems/ruby-1.9.1-p378/gems/cucumber-0.6.3/lib/cucumber/cli/main.rb:20:in `execute'
/home/artem/.rvm/gems/ruby-1.9.1-p378/gems/cucumber-0.6.3/bin/cucumber:8:in `<top (required)>'
/home/artem/.rvm/gems/ruby-1.9.1-p378/bin/cucumber:19:in `load'
/home/artem/.rvm/gems/ruby-1.9.1-p378/bin/cucumber:19:in `<main>'
Missing these required gems:
selenium-client
Selenium
rspec-rails
You're running:
ruby 1.9.1.378 at /home/artem/.rvm/rubies/ruby-1.9.1-p378/bin/ruby
rubygems 1.3.5 at /home/artem/.rvm/gems/ruby-1.9.1-p378, /home/artem/.rvm/gems/ruby-1.9.1-p378%global
所有的宝石显然都在那里:
artem:~/projects/food4feed (master)$ gem list | egrep "elenium|rspec|test-unit"
rspec (1.3.0)
rspec-rails (1.3.2)
Selenium (1.1.14)
selenium-client (1.2.18)
test-unit (2.0.7)
更令人困惑的是,它只对某些 gem 抱怨。 factory_girl
和 rspec
没有引起问题。
你有什么想法吗?
我的环境:
- Rails 2.3.5
- cucumber (0.6.3)
- cucumber-rails (0.3.0)
test-unit
是上述其中一个 gem 的依赖项。它只是为了让rake gems:install RAILS_ENV=cucumber
安装它而存在的。 - artemavetest-unit
实际上并不会引起问题,因为它是:lib => false
。这是我的错,我想我在第一次复制堆栈跟踪时复制了错误的内容(已纠正)。但是,这并不改变问题。 - artemave