class Cucumber::Rake::Task
See the attributes for additional configuration possibilities.
end
t.cucumber_opts = %w{–format progress}
Cucumber::Rake::Task.new do |t|
To further configure the task, you can pass a block:
It will use steps from ‘features/*/.rb’ and features in ‘features/*/.feature’.
This will define a task named cucumber
described as ‘Run Cucumber features’.
Cucumber::Rake::Task.new
The simplest use of it goes something like:
Defines a Rake task for running features.
def cucumber_opts=(opts) #:nodoc:
def cucumber_opts=(opts) #:nodoc: @cucumber_opts = String === opts ? opts.split(' ') : opts end
def cucumber_opts_with_profile #:nodoc:
def cucumber_opts_with_profile #:nodoc: @profile ? [cucumber_opts, '--profile', @profile] : cucumber_opts end
def define_task #:nodoc:
def define_task #:nodoc: desc @desc task @task_name do runner.run end end
def feature_files #:nodoc:
def feature_files #:nodoc: make_command_line_safe(FileList[ ENV['FEATURE'] || [] ]) end
def initialize(task_name = "cucumber", desc = "Run Cucumber features")
def initialize(task_name = "cucumber", desc = "Run Cucumber features") @task_name, @desc = task_name, 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
def make_command_line_safe(list)
def make_command_line_safe(list) list.map{|string| string.gsub(' ', '\ ')} end
def runner(task_args = nil) #:nodoc:
def runner(task_args = nil) #:nodoc: cucumber_opts = [(ENV['CUCUMBER_OPTS'] ? ENV['CUCUMBER_OPTS'].split(/\s+/) : nil) || cucumber_opts_with_profile] if(@fork) return ForkedCucumberRunner.new(libs, binary, cucumber_opts, bundler, feature_files) end InProcessCucumberRunner.new(libs, cucumber_opts, feature_files) end