Class: Cucumber::Formatter::PrettyFail

Inherits:
Pretty
  • Object
show all
Defined in:
lib/cucumber/formatter/pretty_fail.rb

Overview

The formatter used for --format pretty-fail

Instance Method Summary collapse

Constructor Details

#initialize(runtime, path_or_io, options) ⇒ PrettyFail

Returns a new instance of PrettyFail.



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/cucumber/formatter/pretty_fail.rb', line 14

def initialize(runtime, path_or_io, options)
  @runtime, @output, @options = runtime, ensure_io(path_or_io, "pretty-fail"), options
  @io = StringIO.new # the fake io for the pretty formatter we inherit from
  @snippets_input = []
  @previous_step_keyword = nil

  @exceptions = []
  @indent = 0
  @prefixes = options[:prefixes] || {}
  @delayed_messages = []
end

Instance Method Details

#after_feature_element(*args) ⇒ Object



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

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

#after_features(features) ⇒ Object



26
27
28
29
30
# File 'lib/cucumber/formatter/pretty_fail.rb', line 26

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

#after_outline_table(outline_table) ⇒ Object



62
63
64
65
# File 'lib/cucumber/formatter/pretty_fail.rb', line 62

def after_outline_table(outline_table)
  super
  @outline_table = nil
end

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



52
53
54
55
# File 'lib/cucumber/formatter/pretty_fail.rb', line 52

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



48
49
50
# File 'lib/cucumber/formatter/pretty_fail.rb', line 48

def after_steps(*args)
  @exception_raised = false
end

#before_feature_element(*args) ⇒ Object



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

def before_feature_element(*args)
  super
  @exception_raised = false
end

#before_outline_table(outline_table) ⇒ Object



57
58
59
60
# File 'lib/cucumber/formatter/pretty_fail.rb', line 57

def before_outline_table(outline_table)
  super
  @outline_table = outline_table
end

#before_steps(*args) ⇒ Object



43
44
45
46
# File 'lib/cucumber/formatter/pretty_fail.rb', line 43

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

#exception(*args) ⇒ Object



74
75
76
77
# File 'lib/cucumber/formatter/pretty_fail.rb', line 74

def exception(*args)
  super
  @exception_raised = true
end

#table_cell_value(value, status) ⇒ Object



67
68
69
70
71
72
# File 'lib/cucumber/formatter/pretty_fail.rb', line 67

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