Class: Cucumber::Formatter::Rerun

Inherits:
Object
  • Object
show all
Includes:
Io
Defined in:
lib/cucumber/formatter/rerun.rb

Instance Method Summary collapse

Methods included from Io

ensure_dir, ensure_file, ensure_io

Constructor Details

#initialize(config) ⇒ Rerun

Returns a new instance of Rerun



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/cucumber/formatter/rerun.rb', line 10

def initialize(config)
  @io = ensure_io(config.out_stream)
  @config = config
  @failures = {}
  config.on_event :test_case_finished do |event|
    test_case, result = *event.attributes
    next if result.ok?(@config.strict)
    @failures[test_case.location.file] ||= []
    @failures[test_case.location.file] << test_case.location.line
  end
  config.on_event :test_run_finished do
    next if @failures.empty?
    @io.print file_failures.join("\n")
  end
end