class Lucid::Formatter::Rerun
The formatter used for --format rerun
This formatter keeps track of all failing features and print out their location. Example:
features/foo.feature:34 features/bar.feature:11:76:81
This formatter is used by AutoTest - it will use the output to decide what to run the next time, simply passing the output string on the command line.
Public Class Methods
new(runtime, path_or_io, options)
click to toggle source
# File lib/lucid/formatter/rerun.rb, line 18 def initialize(runtime, path_or_io, options) @io = ensure_io(path_or_io, "rerun") @options = options @file_names = [] @file_colon_lines = Hash.new{|h,k| h[k] = []} end
Public Instance Methods
after_examples(*args)
click to toggle source
# File lib/lucid/formatter/rerun.rb, line 71 def after_examples(*args) @in_examples = false end
after_feature(*)
click to toggle source
# File lib/lucid/formatter/rerun.rb, line 30 def after_feature(*) unless @lines.empty? after_first_time do @io.print ' ' end @io.print "#{@file}:#{@lines.join(':')}" @io.flush end end
after_feature_element(feature_element)
click to toggle source
# File lib/lucid/formatter/rerun.rb, line 48 def after_feature_element(feature_element) if (@rerun || feature_element.failed?) && !(AST::ScenarioOutline === feature_element) @lines << feature_element.line end end
after_features(features)
click to toggle source
# File lib/lucid/formatter/rerun.rb, line 40 def after_features(features) @io.close end
after_table_row(table_row)
click to toggle source
# File lib/lucid/formatter/rerun.rb, line 54 def after_table_row(table_row) return unless @in_examples and Lucid::AST::OutlineTable::ExampleRow === table_row unless @header_row if table_row.failed? @rerun = true @lines << table_row.line end end @header_row = false if @header_row end
before_examples(*args)
click to toggle source
# File lib/lucid/formatter/rerun.rb, line 66 def before_examples(*args) @header_row = true @in_examples = true end
before_feature(feature_element)
click to toggle source
# File lib/lucid/formatter/rerun.rb, line 25 def before_feature(feature_element) @lines = [] @file = feature_element.file end
before_feature_element(feature_element)
click to toggle source
# File lib/lucid/formatter/rerun.rb, line 44 def before_feature_element(feature_element) @rerun = false end
before_table_row(table_row)
click to toggle source
# File lib/lucid/formatter/rerun.rb, line 75 def before_table_row(table_row) return unless @in_examples end
step_name(keyword, step_match, status, source_indent, background, file_colon_line)
click to toggle source
# File lib/lucid/formatter/rerun.rb, line 79 def step_name(keyword, step_match, status, source_indent, background, file_colon_line) @rerun = true if [:failed, :pending, :undefined].index(status) end
Private Instance Methods
after_first_time() { || ... }
click to toggle source
# File lib/lucid/formatter/rerun.rb, line 85 def after_first_time yield if @not_first_time @not_first_time = true end