class Spinach::Reporter::Rerun

Public Instance Methods

after_run(success) click to toggle source
Calls superclass method
# File lib/spinach/reporter/rerun.rb, line 17
def after_run(success)
  super success

  # save rerun scenarios in a file
  File.open(rerun_file, 'w') { |f| f.write @rerun.join("\n") } unless success
end
before_run(*args) click to toggle source
Calls superclass method
# File lib/spinach/reporter/rerun.rb, line 4
def before_run(*args)
  super(*args)

  # reset rerun.txt file
  File.delete(rerun_file) if File.file?(rerun_file)

  # create tmp folder if not exists
  Dir.mkdir('tmp', 0o755) unless Dir.exist?('tmp')

  # rerun list of failing scenarios
  @rerun = []
end
on_error_step(step, failure, step_location, step_definitions=nil) click to toggle source
Calls superclass method
# File lib/spinach/reporter/rerun.rb, line 31
def on_error_step(step, failure, step_location, step_definitions=nil)
  super step, failure, step_location, step_definitions

  # save feature file and scenario line
  @rerun << "#{current_feature.filename}:#{current_scenario.lines[0]}"
end
on_failed_step(step, failure, step_location, step_definitions=nil) click to toggle source
Calls superclass method
# File lib/spinach/reporter/rerun.rb, line 24
def on_failed_step(step, failure, step_location, step_definitions=nil)
  super step, failure, step_location, step_definitions

  # save feature file and scenario line
  @rerun << "#{current_feature.filename}:#{current_scenario.lines[0]}"
end

Private Instance Methods

rerun_file() click to toggle source
# File lib/spinach/reporter/rerun.rb, line 40
def rerun_file
  ENV['SPINACH_RERUN_FILE'] || 'tmp/spinach-rerun.txt'
end