bonhoffer
bonhoffer

Reputation: 1473

bundle installed cucumber generators not found

I am trying to install cucumber on rails 2.3.11 (gem -v = 1.6.2) with the following Gemfile

group :test do
  gem 'fabrication'
  gem 'cucumber'
  gem 'cucumber-rails'
end

Bundle install is successful, but I can't find the 'cucumber' generator.

bundle exec script/generate cucumber
/Users/Tim/.rvm/gems/ree-1.8.7-2011.03@new_horizons/gems/rails-2.3.11/lib/rails_generator/lookup.rb:212:Warning: Gem::cache is deprecated and will be removed on or after August 2011.  Use Gem::source_index.
/Users/Tim/.rvm/gems/ree-1.8.7-2011.03@new_horizons/gems/rails-2.3.11/lib/rails_generator/lookup.rb:234:Warning: Gem::cache is deprecated and will be removed on or after August 2011.  Use Gem::source_index.
Couldn't find 'cucumber' generator

Any thoughts greatly appreciated. I am running: ruby 1.8.7 (2011-02-18 patchlevel 334) [i686-darwin10.7.0], MBARI 0x6770, Ruby Enterprise Edition 2011.03

tim

Upvotes: 3

Views: 2037

Answers (3)

Peter Brown
Peter Brown

Reputation: 51697

According to the cucumber-rails documentation, the generate command should be cucumber:install, not just cucumber. It also says it's for Rails 3, not sure if that's true though.

Upvotes: 2

Sam 山
Sam 山

Reputation: 42865

First thought is to upgrade your ruby version. In the long run that will solve more problems as newer gems are becoming dependent on ruby 1.9.2. Install RVM and use that to manage your different ruby versions and gem sets.

The second thing is to do what the error is saying.

gem sources

That will show you which souces and gems you have. Something like this:

*** CURRENT SOURCES ***

http://rubygems.org/

If you know where you specific gem is being hosted then you can add those sources to the top of your bundler file. Usually all you need is http://rubygems.org/.

But you can also add it directly to your sources with this:

gem sources:add `http://rubygems.org/`

Upvotes: 1

Ryan Bigg
Ryan Bigg

Reputation: 107718

When you're running the generators they are actually running in the development environment, not test. Therefore these dependencies won't be loaded. Put them in a group like this instead:

group :development, :test do
  gem 'cucumber-rails'
  ...
end

Secondly, you don't need to specify cucumber as well as cucumber-rails, as the cucumber gem is a dependency of the cucumber-rails gem and will be automatically included.

Upvotes: 2

Related Questions