class Jekyll::Cucumber::Formatter

Constants

CHARS

Attributes

indent[RW]
runtime[RW]

Public Class Methods

new(runtime, path_or_io, options) click to toggle source
# File lib/support/formatter.rb, line 24
def initialize(runtime, path_or_io, options)
  @runtime = runtime
  @snippets_input = []
  @io = ensure_io(path_or_io)
  @prefixes = options[:prefixes] || {}
  @delayed_messages = []
  @options = options
  @exceptions = []
  @indent = 0
  @timings = {}
end

Public Instance Methods

after_background(_background) click to toggle source
# File lib/support/formatter.rb, line 96
def after_background(_background)
  @in_background = nil
end
after_feature_element(feature_element) click to toggle source
# 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) click to toggle source
# File lib/support/formatter.rb, line 44
def after_features(features)
  @io.puts
  print_worst_offenders
  print_summary(features)
end
after_tags(tags) click to toggle source
# File lib/support/formatter.rb, line 84
def after_tags(tags); end
after_test_step(test_step, result) click to toggle source
# 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) click to toggle source
# 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) click to toggle source
# File lib/support/formatter.rb, line 88
def before_background(_background)
  @scenario_indent = 2
  @in_background = true
  @indent = 2
end
before_feature(_feature) click to toggle source
# File lib/support/formatter.rb, line 52
def before_feature(_feature)
  @exceptions = []
  @indent = 0
end
before_feature_element(feature_element) click to toggle source
# 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) click to toggle source
# File lib/support/formatter.rb, line 38
def before_features(_features)
  print_profile_information
end
before_step(step) click to toggle source
# 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) click to toggle source

rubocop:disable Metrics/ParameterLists

# 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) click to toggle source
# File lib/support/formatter.rb, line 82
def comment_line(comment_line); end
exception(exception, status) click to toggle source
# 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) click to toggle source
# 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) click to toggle source
# 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) click to toggle source
# 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) click to toggle source
# File lib/support/formatter.rb, line 80
def tag_name(tag_name); end

Private Instance Methods

cell_prefix(status) click to toggle source
# File lib/support/formatter.rb, line 189
def cell_prefix(status)
  @prefixes[status]
end
print_feature_element_name(keyword, name, source_line, _indent) click to toggle source
print_summary(features) click to toggle source
print_worst_offenders() click to toggle source