Class: Riot::FancyDotReporter

Inherits:
IOReporter
  • Object
show all
Defined in:
lib/riot-fancydots/fancy_dot_reporter.rb

Instance Method Summary collapse

Constructor Details

#initialize(writer = STDOUT) ⇒ FancyDotReporter

Returns a new instance of FancyDotReporter.



3
4
5
6
7
# File 'lib/riot-fancydots/fancy_dot_reporter.rb', line 3

def initialize(writer=STDOUT)
  super
  puts "\n"
  @details = []
end

Instance Method Details

#error(description, e) ⇒ Object



18
19
20
21
22
# File 'lib/riot-fancydots/fancy_dot_reporter.rb', line 18

def error(description, e)
  print red("E")
  location = filter_backtrace(e.backtrace).last
  @details << "#{red bold('ERROR')}   #{green dark(line_info(*location.split(':').reverse))} #{test_detail(description, white(dark(format_error e)))}"
end

#fail(description, message, line, file) ⇒ Object



13
14
15
16
# File 'lib/riot-fancydots/fancy_dot_reporter.rb', line 13

def fail(description, message, line, file)
  print yellow("F")
  @details << "#{yellow bold('FAILURE')} #{green dark(line_info(line, file))} #{test_detail(description, message)}".strip
end

#pass(description, message) ⇒ Object



9
10
11
# File 'lib/riot-fancydots/fancy_dot_reporter.rb', line 9

def pass(description, message)
  print green(".")
end

#results(time_taken) ⇒ Object



24
25
26
27
# File 'lib/riot-fancydots/fancy_dot_reporter.rb', line 24

def results(time_taken)
  puts "\n\n#{@details.join("\n\n")}" unless @details.empty?
  super
end