Class: Test::Reporters::Dotprogress

Inherits:
Abstract
  • Object
show all
Defined in:
lib/rubytest/format/dotprogress.rb

Overview

Simple Dot-Progress Reporter

Instance Attribute Summary

Attributes inherited from Abstract

#runner

Instance Method Summary collapse

Methods inherited from Abstract

#begin_case, #begin_suite, #begin_test, #end_case, #end_test, inherited, #initialize, registry, #skip_case

Constructor Details

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

Instance Method Details

#end_suite(suite) ⇒ Object



32
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
# File 'lib/rubytest/format/dotprogress.rb', line 32

def end_suite(suite)
  puts; puts
  puts timestamp
  puts

  if runner.verbose?
    unless record[:omit].empty?
      puts "SKIPPED\n\n"
      record[:skip].each do |test, reason|
        puts "    #{test}".ansi(:bold)
        puts "    #{reason}" if String===reason
        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 "    " + clean_backtrace(exception).join("\n    ")
      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 "    " + clean_backtrace(exception).join("\n    ")
      puts
    end
  end

  puts tally
end

#error(unit, exception) ⇒ Object



22
23
24
25
# File 'lib/rubytest/format/dotprogress.rb', line 22

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

#fail(unit, exception) ⇒ Object



17
18
19
20
# File 'lib/rubytest/format/dotprogress.rb', line 17

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

#pass(unit) ⇒ Object



12
13
14
15
# File 'lib/rubytest/format/dotprogress.rb', line 12

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

#skip_test(unit, reason) ⇒ Object



8
9
10
# File 'lib/rubytest/format/dotprogress.rb', line 8

def skip_test(unit, reason)
  print "S".ansi(:cyan) if runner.verbose?
end

#todo(unit, exception) ⇒ Object



27
28
29
30
# File 'lib/rubytest/format/dotprogress.rb', line 27

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