Class: Test::Reporters::Summary

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

Overview

Summary Reporter

Constant Summary collapse

SEP =
'  '

Instance Method Summary collapse

Instance Method Details

#begin_case(tc) ⇒ Object



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

def begin_case(tc)
  @tc << tc.to_s.split("\n").first
end

#begin_suite(suite) ⇒ Object



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

def begin_suite(suite)
  timer_reset
  @tc = []
end

#end_case(test_case) ⇒ Object



83
84
85
# File 'lib/rubytest/format/summary.rb', line 83

def end_case(test_case)
  @tc.pop
end

#end_suite(suite) ⇒ Object



88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/rubytest/format/summary.rb', line 88

def end_suite(suite)
  puts

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

  unless record[:fail].empty?
    puts "FAILURES:\n\n"
    record[:fail].each do |test, exception|
      puts "    #{test}"
      puts "    #{file_and_line(exception)}"
      puts "    #{exception}"
      puts code(exception).to_s
      #puts "    #{exception.backtrace[0]}"
      puts
    end
  end

  unless record[:error].empty?
    puts "ERRORS:\n\n"
    record[:error].each do |test, exception|
      puts "    #{test}"
      puts "    #{file_and_line(exception)}"
      puts "    #{exception}"
      puts code(exception).to_s
      #puts "    #{exception.backtrace[0]}"
      puts
    end
  end

  puts timestamp
  puts
  puts tally
end

#error(test, exception) ⇒ Object



55
56
57
58
59
# File 'lib/rubytest/format/summary.rb', line 55

def error(test, exception)
  print "ERROR  ".ansi(:red, :bold)
  e = @tc + [test.to_s]
  puts e.join(SEP).ansi(:red)
end

#fail(test, exception) ⇒ Object



48
49
50
51
52
# File 'lib/rubytest/format/summary.rb', line 48

def fail(test, exception)
  print "FAIL  ".ansi(:red, :bold)
  e = @tc + [test.to_s]
  puts e.join(SEP).ansi(:red)
end

#omit(test) ⇒ Object



69
70
71
72
73
# File 'lib/rubytest/format/summary.rb', line 69

def omit(test)
  print "OMIT  ".ansi(:cyan, :bold)
  e = @tc + [test.to_s]
  puts e.join(SEP).ansi(:cyan)
end

#pass(test) ⇒ Object



41
42
43
44
45
# File 'lib/rubytest/format/summary.rb', line 41

def pass(test)
  print "PASS  ".ansi(:green, :bold)
  e = @tc + [test.to_s]
  puts e.join(SEP).ansi(:green)
end

#skip_test(test) ⇒ Object



76
77
78
79
80
# File 'lib/rubytest/format/summary.rb', line 76

def skip_test(test)
  print "SKIP ".ansi(:blue, :bold)
  e = @tc + [test.to_s]
  puts e.join(SEP).ansi(:blue)
end

#todo(test, exception) ⇒ Object



62
63
64
65
66
# File 'lib/rubytest/format/summary.rb', line 62

def todo(test, exception)
  print "TODO  ".ansi(:yellow, :bold)
  e = @tc + [test.to_s]
  puts e.join(SEP).ansi(:yellow)
end