Sha256: 5d3a72db1891cb6643b7cb45197357217e58e8dc1ef9260a743dff001d4a1f36

Contents?: true

Size: 1.28 KB

Versions: 3

Compression:

Stored size: 1.28 KB

Contents

desc 'cucumber [FILES]', 'Run Cucumber features'
long_desc <<-LONGDESC
Example: `geordi cucumber features/authentication_feature:3`

Runs Cucumber as you want: with `bundle exec`, `cucumber_spinner` detection,
separate Firefox for Selenium, etc.

Sometimes, the dot-printing Cucumber formatter does not show errors. In case a
feature fails without a message, try calling with `--debug` or `-d`.

Any unknown option will be passed through to Cucumber, e.g. `--format pretty`.
LONGDESC

option :verbose, :aliases => '-v', :type => :boolean,
  :desc => 'Print the testrun command'
option :debug, :aliases => '-d', :type => :boolean,
  :desc => 'Run with `-f pretty -b` which helps hunting down bugs'
option :rerun, :aliases => '-r', :type => :numeric, :default => 0,
  :desc => 'Rerun features up to N times while failing'

def cucumber(*files)
  if File.directory?('features')
    require 'geordi/cucumber'

    invoke_cmd 'bundle_install'

    announce 'Running features'
    files << '--format' << 'pretty' << '-b' if options.debug
    (1 + options.rerun).times do |i|
      return true if Geordi::Cucumber.new.run(files, :verbose => options.verbose)

      announce "Rerun ##{ i + 1 } of #{ options.rerun }"
    end
    fail 'Features failed.' # Give up

  else
    note 'Cucumber not employed.'
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
geordi-1.2.2 lib/geordi/commands/cucumber.rb
geordi-1.2.1 lib/geordi/commands/cucumber.rb
geordi-1.2.0 lib/geordi/commands/cucumber.rb