Class: Test::Reporters::Dotprogress

Inherits:
Abstract
  • Object
show all
Defined in:
lib/test/reporters/dotprogress.rb

Overview

Simple Dot-Progress Reporter

Constant Summary

Constants inherited from Abstract

Abstract::TITLES

Instance Attribute Summary

Attributes inherited from Abstract

#runner

Instance Method Summary collapse

Methods inherited from Abstract

#begin_case, #begin_suite, #begin_test, #clean_backtrace, #code, #end_case, #end_test, #file, #file_and_line, #file_and_line_array, inherited, #initialize, #line, #record, registry, #skip_case, #skip_test, #subtotal, #tally, #tally_item, #timestamp, #total, #total_count

Constructor Details

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

Instance Method Details

#end_suite(suite) ⇒ Object



33
34
35
36
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/test/reporters/dotprogress.rb', line 33

def end_suite(suite)
  puts; puts
  puts timestamp
  puts

  if runner.verbose?
    unless record[:omit].empty?
      puts "OMISSIONS\n\n"
      record[:omit].each do |test, exception|
        puts "    #{test}".ansi(:bold)
        puts "    #{exception}"
        puts "    #{file_and_line(exception)}"
        #puts code(exception)
        puts
      end
    end
  end

  unless record[:todo].empty?
    puts "PENDING\n\n"
    record[:todo].each do |test, exception|
      puts "    #{test}".ansi(:bold) unless test.to_s.empty?
      puts "    #{exception}"
      puts "    #{file_and_line(exception)}"
      puts code(exception)
      puts
    end
  end

  unless record[:fail].empty?
    puts "FAILURES\n\n"
    record[:fail].each do |test_unit, exception|
      puts "    #{test_unit}".ansi(:bold)
      puts "    #{exception}"
      puts "    #{file_and_line(exception)}"
      puts code(exception)
      puts
    end
  end

  unless record[:error].empty?
    puts "ERRORS\n\n"
    record[:error].each do |test_unit, exception|
      puts "    #{test_unit}".ansi(:bold)
      puts "    #{exception}"
      puts "    #{file_and_line(exception)}"
      puts code(exception)
      puts
    end
  end

  puts tally
end

#error(unit, exception) ⇒ Object



18
19
20
21
# File 'lib/test/reporters/dotprogress.rb', line 18

def error(unit, exception)
  print "E".ansi(:red, :bold)
  $stdout.flush
end

#fail(unit, exception) ⇒ Object



13
14
15
16
# File 'lib/test/reporters/dotprogress.rb', line 13

def fail(unit, exception)
  print "F".ansi(:red)
  $stdout.flush
end

#omit(unit, exception) ⇒ Object



28
29
30
31
# File 'lib/test/reporters/dotprogress.rb', line 28

def omit(unit, exception)
  print "O".ansi(:cyan)
  $stdout.flush
end

#pass(unit) ⇒ Object



8
9
10
11
# File 'lib/test/reporters/dotprogress.rb', line 8

def pass(unit)
  print "."
  $stdout.flush
end

#todo(unit, exception) ⇒ Object



23
24
25
26
# File 'lib/test/reporters/dotprogress.rb', line 23

def todo(unit, exception)
  print "P".ansi(:yellow)
  $stdout.flush
end