Class: Cucumber::Formatter::Rerun
- Includes:
- Io
- 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
- #after_feature_element(feature_element) ⇒ Object
-
#after_features(features) ⇒ Object
features() is never executed at all…
- #before_feature_element(feature_element) ⇒ Object
-
#initialize(step_mother, path_or_io, options) ⇒ Rerun
constructor
A new instance of Rerun.
- #step_name(keyword, step_match, status, source_indent, background) ⇒ Object
Methods included from Io
#ensure_dir, #ensure_file, #ensure_io
Constructor Details
#initialize(step_mother, path_or_io, options) ⇒ Rerun
Returns a new instance of Rerun.
18 19 20 21 22 23 |
# File 'lib/cucumber/formatter/rerun.rb', line 18 def initialize(step_mother, path_or_io, ) @io = ensure_io(path_or_io, "rerun") @options = @file_names = [] @file_colon_lines = Hash.new{|h,k| h[k] = []} end |
Instance Method Details
#after_feature_element(feature_element) ⇒ Object
42 43 44 45 46 47 48 |
# File 'lib/cucumber/formatter/rerun.rb', line 42 def after_feature_element(feature_element) if @rerun file, line = *feature_element.file_colon_line.split(':') @file_colon_lines[file] << line @file_names << file end end |
#after_features(features) ⇒ Object
features() is never executed at all… ?
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/cucumber/formatter/rerun.rb', line 26 def after_features(features) files = @file_names.uniq.map do |file| lines = @file_colon_lines[file] "#{file}:#{lines.join(':')}" end @io.puts files.join(' ') # Flusing output to rerun tempfile here... @io.flush @io.close end |
#before_feature_element(feature_element) ⇒ Object
38 39 40 |
# File 'lib/cucumber/formatter/rerun.rb', line 38 def before_feature_element(feature_element) @rerun = false end |
#step_name(keyword, step_match, status, source_indent, background) ⇒ Object
50 51 52 |
# File 'lib/cucumber/formatter/rerun.rb', line 50 def step_name(keyword, step_match, status, source_indent, background) @rerun = true if [:failed, :pending, :undefined].index(status) end |