Enabling Cucumber Support in Project
Using Cucumber requires creating an infrastructure, which is necessary for further creating and running tests. This infrastructure is created in a slightly different ways for Ruby projects and Rails applications.
In this section:
Enabling Cucumber support in Ruby projects
In plain Ruby projects, RubyMine provides syntax and error highlighting for feature files and step definitions, and the possibility to create step definitions "from usage". However, you have to produce the necessary folder structure yourself.
Prerequisite
Before you start, make sure that gem 'cucumber'
is specified
in the Gemfile of your project. If this gem is not yet installed,
RubyMine will suggest you to download and install it, and all its dependencies
To enable Cucumber support in a Ruby project, follow these general steps
- Under the project root directory, create a new directory with the name
features
(Context menu of the project root - ). - In this directory, create the required feature files
(Context menu of the
features
directory - -<name>.feature
). - In the feature file, type your scenario. Since there are no step definitions, the steps will be highlighted as unresolved. Create step definitions.
Enabling Cucumber support in Rails applications
Prerequisite
Before you start, make sure that
gem 'cucumber-rails'
is specified in the Gemfile of your project. If this gem is not yet installed,
RubyMine will suggest you to download and install it, and all of its dependencies.
When cucumber-rails
gem is activated,
the cucumber:install
generator appears in the list.
After executing this generator, RubyMine produces the necessary files and directories: