Class: TapOut::Reporters::DotReporter

Inherits:
Abstract
  • Object
show all
Defined in:
lib/tapout/reporters/dot_reporter.rb

Overview

Traditional dot progress reporter.

Constant Summary

Constants inherited from Abstract

Abstract::INTERNALS

Instance Method Summary collapse

Methods inherited from Abstract

#<<, #clean_backtrace, #code_snippet, #complete_cases, #exit_code, #finalize, #finish_case, #finish_test, #handle, inherited, #initialize, #note, #omit, #parse_source_location, #skip, #source, #start_case, #start_test, #tally, #tally_message

Constructor Details

This class inherits a constructor from TapOut::Reporters::Abstract

Instance Method Details

#error(entry) ⇒ Object



30
31
32
33
34
# File 'lib/tapout/reporters/dot_reporter.rb', line 30

def error(entry)
  $stdout.print 'E'.ansi(:yellow)
  $stdout.flush
  super(entry)
end

#fail(entry) ⇒ Object



23
24
25
26
27
# File 'lib/tapout/reporters/dot_reporter.rb', line 23

def fail(entry)
  $stdout.print 'F'.ansi(:red)
  $stdout.flush
  super(entry)
end

#finish_suite(entry) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/tapout/reporters/dot_reporter.rb', line 37

def finish_suite(entry)
  $stdout.puts "\n\n"

  i = 1

  @failed.each do |e|
    #backtrace = clean_backtrace(exception.backtrace)
    $stdout.puts "#{i}. " + (e['label']).ansi(:red)
    $stdout.puts
    $stdout.puts "    #{e['exception']['class']}" if e['exception']['class']
    $stdout.puts "    #{e['exception']['message']}"
    $stdout.puts "    #{e['exception']['file']}:#{e['exception']['line']}" #+ backtrace[0]
    $stdout.puts code_snippet(e['exception'])
    $stdout.puts
    i += 1
  end

  @raised.each do |e|
    #backtrace = clean_backtrace(exception.backtrace)
    $stdout.puts "#{i}. " + (e['label']).ansi(:yellow)
    $stdout.puts
    $stdout.puts "    #{e['exception']['class']}" if e['exception']['class']
    $stdout.puts "    #{e['exception']['message']}"
    $stdout.puts "    #{e['exception']['file']}:#{e['exception']['line']}" #+ backtrace[0..2].join("    \n")
    $stdout.puts code_snippet(e['exception'])
    $stdout.puts
    i += 1
  end

  $stdout.puts "Finished in #{Time.now - @start_time}s"
  $stdout.puts tally_message(entry)
end

#pass(entry) ⇒ Object



16
17
18
19
20
# File 'lib/tapout/reporters/dot_reporter.rb', line 16

def pass(entry)
  $stdout.print '.'
  $stdout.flush
  super(entry)
end

#start_suite(entry) ⇒ Object



10
11
12
13
# File 'lib/tapout/reporters/dot_reporter.rb', line 10

def start_suite(entry)
  @start_time = Time.now
  $stdout.puts "Started\n"
end