Class: Teabag::Formatters::DotFormatter

Inherits:
BaseFormatter show all
Defined in:
lib/teabag/formatters/dot_formatter.rb

Direct Known Subclasses

CleanFormatter

Constant Summary collapse

RED =
31
GREEN =
32
YELLOW =
33
CYAN =
36

Instance Attribute Summary

Attributes inherited from BaseFormatter

#errors, #failures, #passes, #pendings, #total

Instance Method Summary collapse

Methods inherited from BaseFormatter

#exception, #initialize, #suppress_logs?

Constructor Details

This class inherits a constructor from Teabag::Formatters::BaseFormatter

Instance Method Details

#error(error) ⇒ Object

Errors are reported from the onError handler in Phantom, so they’re not linked to a result



24
25
26
27
28
29
30
# File 'lib/teabag/formatters/dot_formatter.rb', line 24

def error(error)
  log "#{error["message"]}\n", RED
  for trace in error["trace"] || []
    log "  # #{filename(trace["file"])}:#{trace["line"]}#{trace["function"].present? ? " -- #{trace["function"]}" : ""}\n", CYAN
  end
  log "\n"
end

#result(results) ⇒ Object



32
33
34
35
36
37
38
# File 'lib/teabag/formatters/dot_formatter.rb', line 32

def result(results)
  log "\n\n"
  log_information
  log_stats(results)
  log_failed_examples
  super
end

#spec(result) ⇒ Object



12
13
14
15
16
17
18
19
20
21
# File 'lib/teabag/formatters/dot_formatter.rb', line 12

def spec(result)
  super
  if result.passing?
    log ".", GREEN
  elsif result.pending?
    log "*", YELLOW
  else
    log "F", RED
  end
end