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), 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
42
# File 'lib/cucumber/formatter/pretty_fail.rb', line 37

def after_feature_element(*args)
  super
  print_io if exception_raised?
  @exception_raised = false
  reset_io
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



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

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



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

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



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

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



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

def before_outline_table(outline_table)
  super
  @outline_table = outline_table
end

#before_steps(*args) ⇒ Object



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

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

#exception(*args) ⇒ Object



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

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

#table_cell_value(value, status) ⇒ Object



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

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