简体   繁体   中英

Ruby on Rails-Cucumber - error: Could not find generator cucumber:install

I'm new to RoR and Cucumber. I've installed RoR and Cucumber and am stepping through the Cucumber Backgrounder ( https://github.com/cucumber/cucumber/wiki/Cucumber-Backgrounder )

When I get to this step: run "rails generate cucumber:install" I receive the error: Could not find generator cucumber:install

I reviewed a very similar issue relative to JRuby:

Jruby and Cucumber / Cucumber Rails - Could not find generator cucumber:install

I've tried all of the suggestions there (to the best of my ability) and still get the error message. (setting GEM_HOME and GEM_PATH variables, modifying Gemfile, etc.)

My Gemfile:

source 'https://rubygems.org'


# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.4'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.3'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer',  platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0',          group: :doc

# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use unicorn as the app server
# gem 'unicorn'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

# Use debugger
# gem 'debugger', group: [:development, :test]

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin]

# added by SC to get cucumber to install
group :test do
  gem 'cucumber-rails', :require => false
  # database_cleaner is not required, but highly recommended
  gem 'database_cleaner'
end

When I run bundle install I notice that cucumber and cucumber-rails are not in the list. I managed to install both locally, but that didn't resolve the issue.

Any suggestions are appreciated.

you need add in you GemFile in the group of :development, :test

gem 'cucumber-rails', '~> 1.4.2', :require => false

Next use:

rails g cucumber:install

And that's it

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM