Class: Cucumber::Formatter::Rerun
- Defined in:
- lib/cucumber/formatter/rerun.rb
Overview
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.
Instance Method Summary collapse
- #feature_element(feature_element) ⇒ Object
- #features(features) ⇒ Object
-
#initialize(step_mother, io, options) ⇒ Rerun
constructor
A new instance of Rerun.
- #step_name(keyword, step_match, status, source_indent, background) ⇒ Object
Constructor Details
#initialize(step_mother, io, options) ⇒ Rerun
Returns a new instance of Rerun.
14 15 16 17 18 19 |
# File 'lib/cucumber/formatter/rerun.rb', line 14 def initialize(step_mother, io, ) @io = io @options = @file_names = [] @file_colon_lines = Hash.new{|h,k| h[k] = []} end |
Instance Method Details
#feature_element(feature_element) ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'lib/cucumber/formatter/rerun.rb', line 30 def feature_element(feature_element) @rerun = false super if @rerun file, line = *feature_element.file_colon_line.split(':') @file_colon_lines[file] << line @file_names << file end end |
#features(features) ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/cucumber/formatter/rerun.rb', line 21 def features(features) super files = @file_names.uniq.map do |file| lines = @file_colon_lines[file] "#{file}:#{lines.join(':')}" end @io.puts files.join(' ') end |
#step_name(keyword, step_match, status, source_indent, background) ⇒ Object
40 41 42 |
# File 'lib/cucumber/formatter/rerun.rb', line 40 def step_name(keyword, step_match, status, source_indent, background) @rerun = true if [:failed].index(status) end |