class Cucumber::Rake::Task

Defines a Rake task for running features.

The simplest use of it goes something like:

Cucumber::Rake::Task.new

This will define a task named cucumber described as 'Run Cucumber features'. It will use steps from 'features/*/.rb' and features in 'features/*/.feature'.

To further configure the task, you can pass a block:

Cucumber::Rake::Task.new do |t|
  t.cucumber_opts = %w{--format progress}
end

See the attributes for additional configuration possibilities.

Attributes

binary[RW]

Name of the cucumber binary to use for running features. Defaults to Cucumber::BINARY

bundler[RW]

Whether or not to run with bundler (bundle exec). Setting this to false may speed up the execution. The default value is true if Bundler is installed and you have a Gemfile, false otherwise.

Note that this attribute has no effect if you don't run in forked mode.

cucumber_opts[R]

Extra options to pass to the cucumber binary. Can be overridden by the CUCUMBER_OPTS environment variable. It's recommended to pass an Array, but if it's a String it will be split by ' '.

fork[RW]

Whether or not to fork a new ruby interpreter. Defaults to true. You may gain some startup speed if you set it to false, but this may also cause issues with your load path and gems.

libs[RW]

Directories to add to the Ruby $LOAD_PATH

profile[RW]

Define what profile to be used. When used with cucumber_opts it is simply appended to it. Will be ignored when CUCUMBER_OPTS is used.

task_name[R]

Name of the running task

Public Class Methods

new(task_name = 'cucumber', desc = 'Run Cucumber features') { |self| ... } click to toggle source

Define Cucumber Rake task

# File lib/cucumber/rake/task.rb, line 137
def initialize(task_name = 'cucumber', desc = 'Run Cucumber features')
  @task_name = task_name
  @desc = desc
  @fork = true
  @libs = ['lib']
  @rcov_opts = %w[--rails --exclude osx\/objc,gems\/]
  yield self if block_given?
  @binary = binary.nil? ? Cucumber::BINARY : File.expand_path(binary)
  define_task
end

Public Instance Methods

make_command_line_safe(list) click to toggle source
# File lib/cucumber/rake/task.rb, line 169
def make_command_line_safe(list)
  list.map { |string| string.gsub(' ', '\ ') }
end