Class: Cucumber::Formatter::Progress

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

Overview

The formatter used for --format progress

Direct Known Subclasses

Usage

Constant Summary

Constants included from ANSIColor

ANSIColor::ALIASES

Constants included from Term::ANSIColor

Term::ANSIColor::ATTRIBUTES, Term::ANSIColor::ATTRIBUTE_NAMES, Term::ANSIColor::COLORED_REGEXP

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Io

#ensure_dir, #ensure_file, #ensure_io

Methods included from Console

#collect_failing_scenarios, #collect_snippet_data, #embed, #empty_messages, #format_step, #format_string, #linebreaks, #print_elements, #print_exception, #print_failing_scenarios, #print_message, #print_messages, #print_passing_wip, #print_profile_information, #print_snippets, #print_stats, #print_steps, #print_table_row_messages, #puts

Methods included from ANSIColor

#cukes, define_grey, define_real_grey, #green_cukes, #grey, #red_cukes, #yellow_cukes

Methods included from Term::ANSIColor

attributes, coloring=, coloring?, #uncolored

Methods included from Summary

#scenario_summary, #step_summary

Methods included from Duration

#format_duration

Constructor Details

#initialize(runtime, path_or_io, options) ⇒ Progress

Returns a new instance of Progress.



12
13
14
15
16
# File 'lib/cucumber/formatter/progress.rb', line 12

def initialize(runtime, path_or_io, options)
  @runtime, @io, @options = runtime, ensure_io(path_or_io, "progress"), options
  @previous_step_keyword = nil
  @snippets_input = []
end

Instance Attribute Details

#runtimeObject (readonly)

Returns the value of attribute runtime.



10
11
12
# File 'lib/cucumber/formatter/progress.rb', line 10

def runtime
  @runtime
end

Instance Method Details

#after_feature_element(*args) ⇒ Object



32
33
34
35
# File 'lib/cucumber/formatter/progress.rb', line 32

def after_feature_element(*args)
  progress(:failed) if (defined? @exception_raised) and (@exception_raised)
  @exception_raised = false
end

#after_features(features) ⇒ Object



22
23
24
25
26
# File 'lib/cucumber/formatter/progress.rb', line 22

def after_features(features)
  @io.puts
  @io.puts
  print_summary(features)
end

#after_outline_table(outline_table) ⇒ Object



55
56
57
# File 'lib/cucumber/formatter/progress.rb', line 55

def after_outline_table(outline_table)
  @outline_table = nil
end

#after_step_result(keyword, step_match, multiline_arg, status, exception, source_indent, background, file_colon_line) ⇒ Object



46
47
48
49
# File 'lib/cucumber/formatter/progress.rb', line 46

def after_step_result(keyword, step_match, multiline_arg, status, exception, source_indent, background, file_colon_line)
  progress(status)
  @status = status
end

#after_steps(*args) ⇒ Object



42
43
44
# File 'lib/cucumber/formatter/progress.rb', line 42

def after_steps(*args)
  @exception_raised = false
end

#after_test_step(test_step, result) ⇒ Object



73
74
75
# File 'lib/cucumber/formatter/progress.rb', line 73

def after_test_step(test_step, result)
  collect_snippet_data(test_step, result)
end

#before_feature_element(*args) ⇒ Object



28
29
30
# File 'lib/cucumber/formatter/progress.rb', line 28

def before_feature_element(*args)
  @exception_raised = false
end

#before_features(features) ⇒ Object



18
19
20
# File 'lib/cucumber/formatter/progress.rb', line 18

def before_features(features)
  print_profile_information
end

#before_outline_table(outline_table) ⇒ Object



51
52
53
# File 'lib/cucumber/formatter/progress.rb', line 51

def before_outline_table(outline_table)
  @outline_table = outline_table
end

#before_steps(*args) ⇒ Object



37
38
39
40
# File 'lib/cucumber/formatter/progress.rb', line 37

def before_steps(*args)
  progress(:failed) if (defined? @exception_raised) and (@exception_raised)
  @exception_raised = false
end

#before_test_case(test_case) ⇒ Object



69
70
71
# File 'lib/cucumber/formatter/progress.rb', line 69

def before_test_case(test_case)
  @previous_step_keyword = nil
end

#exception(*args) ⇒ Object



65
66
67
# File 'lib/cucumber/formatter/progress.rb', line 65

def exception(*args)
  @exception_raised = true
end

#table_cell_value(value, status) ⇒ Object



59
60
61
62
63
# File 'lib/cucumber/formatter/progress.rb', line 59

def table_cell_value(value, status)
  return unless @outline_table
  status ||= @status
  progress(status) unless table_header_cell?(status)
end