Installing cucumber for rails

Add the following test group to Gemfile which contains cucumber-rails gem and others related gems.

1group :test do
2  gem 'cucumber-rails', :require => false
3  gem 'database_cleaner'
4  gem 'rspec-rails'
5end

Then install the bundle to the system.

$ bundle install

Cucumber requires an installation before using it. Run the following cucumber:install command.

$ rails generate cucumber:install
    create  config/cucumber.yml
    create  script/cucumber
     chmod  script/cucumber
    create  features/step_definitions
    create  features/support
    create  features/support/env.rb
     exist  lib/tasks
    create  lib/tasks/cucumber.rake
      gsub  config/database.yml
      gsub  config/database.yml
     force  config/database.yml

or alternatively, you can check the options before executing the installation script.

$ rails generate cucumber:install --help

It makes use of the Capybara API. So, if you want to master the cucumber, you need to check all the tools available in the Capybara.

What’s next? We’re going to take a look at “Writing our first feature”.

overlaied image when clicked on thumbnail

Makzan | Ruby on rails 101 | Table of Content