Class: Jekyll::Cucumber::Formatter
- Inherits:
-
Object
- Object
- Jekyll::Cucumber::Formatter
- Includes:
- Cucumber::Formatter::Console, Cucumber::Formatter::Io, FileUtils
- Defined in:
- lib/support/formatter.rb
Constant Summary collapse
- CHARS =
{ :failed => "\u2718".red, :pending => "\u203D".yellow, :undefined => "\u2718".red, :passed => "\u2714".green, :skipped => "\u203D".blue, }.freeze
Instance Attribute Summary collapse
-
#indent ⇒ Object
Returns the value of attribute indent.
-
#runtime ⇒ Object
Returns the value of attribute runtime.
Instance Method Summary collapse
- #after_background(_background) ⇒ Object
- #after_feature_element(feature_element) ⇒ Object
- #after_features(features) ⇒ Object
- #after_tags(tags) ⇒ Object
- #after_test_step(test_step, result) ⇒ Object
- #background_name(keyword, name, source_line, indent) ⇒ Object
- #before_background(_background) ⇒ Object
- #before_feature(_feature) ⇒ Object
- #before_feature_element(feature_element) ⇒ Object
- #before_features(_features) ⇒ Object
- #before_step(step) ⇒ Object
-
#before_step_result(_keyword, _step_match, _multiline_arg, status, exception, _source_indent, background, _file_colon_line) ⇒ Object
rubocop:disable Metrics/ParameterLists.
- #comment_line(comment_line) ⇒ Object
- #exception(exception, status) ⇒ Object
- #feature_element_timing_key(feature_element) ⇒ Object
-
#initialize(runtime, path_or_io, options) ⇒ Formatter
constructor
A new instance of Formatter.
- #scenario_name(keyword, name, source_line, indent) ⇒ Object
- #step_name(_keyword, _step_match, status, _source_indent, _background, _file_colon_line) ⇒ Object
- #tag_name(tag_name) ⇒ Object
Constructor Details
#initialize(runtime, path_or_io, options) ⇒ Formatter
Returns a new instance of Formatter.
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/support/formatter.rb', line 24 def initialize(runtime, path_or_io, ) @runtime = runtime @snippets_input = [] @io = ensure_io(path_or_io) @prefixes = [:prefixes] || {} @delayed_messages = [] @options = @exceptions = [] @indent = 0 @timings = {} end |
Instance Attribute Details
#indent ⇒ Object
Returns the value of attribute indent.
9 10 11 |
# File 'lib/support/formatter.rb', line 9 def indent @indent end |
#runtime ⇒ Object
Returns the value of attribute runtime.
9 10 11 |
# File 'lib/support/formatter.rb', line 9 def runtime @runtime end |
Instance Method Details
#after_background(_background) ⇒ Object
96 97 98 |
# File 'lib/support/formatter.rb', line 96 def after_background(_background) @in_background = nil end |
#after_feature_element(feature_element) ⇒ Object
73 74 75 76 |
# File 'lib/support/formatter.rb', line 73 def after_feature_element(feature_element) @timings[feature_element_timing_key(feature_element)] = Time.now - @timings[feature_element_timing_key(feature_element)] @io.print " (#{@timings[feature_element_timing_key(feature_element)]}s)" end |
#after_features(features) ⇒ Object
44 45 46 47 48 |
# File 'lib/support/formatter.rb', line 44 def after_features(features) @io.puts print_worst_offenders print_summary(features) end |
#after_tags(tags) ⇒ Object
84 |
# File 'lib/support/formatter.rb', line 84 def (); end |
#after_test_step(test_step, result) ⇒ Object
166 167 168 169 170 |
# File 'lib/support/formatter.rb', line 166 def after_test_step(test_step, result) collect_snippet_data( test_step, result ) end |
#background_name(keyword, name, source_line, indent) ⇒ Object
102 103 104 105 106 |
# File 'lib/support/formatter.rb', line 102 def background_name(keyword, name, source_line, indent) print_feature_element_name( keyword, name, source_line, indent ) end |
#before_background(_background) ⇒ Object
88 89 90 91 92 |
# File 'lib/support/formatter.rb', line 88 def before_background(_background) @scenario_indent = 2 @in_background = true @indent = 2 end |
#before_feature(_feature) ⇒ Object
52 53 54 55 |
# File 'lib/support/formatter.rb', line 52 def before_feature(_feature) @exceptions = [] @indent = 0 end |
#before_feature_element(feature_element) ⇒ Object
65 66 67 68 69 |
# File 'lib/support/formatter.rb', line 65 def before_feature_element(feature_element) @indent = 2 @scenario_indent = 2 @timings[feature_element_timing_key(feature_element)] = Time.now end |
#before_features(_features) ⇒ Object
38 39 40 |
# File 'lib/support/formatter.rb', line 38 def before_features(_features) print_profile_information end |
#before_step(step) ⇒ Object
118 119 120 |
# File 'lib/support/formatter.rb', line 118 def before_step(step) @current_step = step end |
#before_step_result(_keyword, _step_match, _multiline_arg, status, exception, _source_indent, background, _file_colon_line) ⇒ Object
rubocop:disable Metrics/ParameterLists
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 |
# File 'lib/support/formatter.rb', line 125 def before_step_result(_keyword, _step_match, _multiline_arg, status, exception, \ _source_indent, background, _file_colon_line) @hide_this_step = false if exception if @exceptions.include?(exception) @hide_this_step = true return end @exceptions << exception end if status != :failed && @in_background ^ background @hide_this_step = true return end @status = status end |
#comment_line(comment_line) ⇒ Object
82 |
# File 'lib/support/formatter.rb', line 82 def comment_line(comment_line); end |
#exception(exception, status) ⇒ Object
156 157 158 159 160 161 162 |
# File 'lib/support/formatter.rb', line 156 def exception(exception, status) return if @hide_this_step @io.puts print_exception(exception, status, @indent) @io.flush end |
#feature_element_timing_key(feature_element) ⇒ Object
59 60 61 |
# File 'lib/support/formatter.rb', line 59 def feature_element_timing_key(feature_element) "\"#{feature_element.name.to_s.sub("Scenario: ", "")}\" (#{feature_element.location})" end |
#scenario_name(keyword, name, source_line, indent) ⇒ Object
110 111 112 113 114 |
# File 'lib/support/formatter.rb', line 110 def scenario_name(keyword, name, source_line, indent) print_feature_element_name( keyword, name, source_line, indent ) end |
#step_name(_keyword, _step_match, status, _source_indent, _background, _file_colon_line) ⇒ Object
148 149 150 151 |
# File 'lib/support/formatter.rb', line 148 def step_name(_keyword, _step_match, status, _source_indent, _background, _file_colon_line) @io.print CHARS[status] @io.print " " end |
#tag_name(tag_name) ⇒ Object
80 |
# File 'lib/support/formatter.rb', line 80 def tag_name(tag_name); end |