Class: Micron::Reporter::Console
Constant Summary
collapse
- CONSOLE_WIDTH =
100
Instance Method Summary
collapse
#end_file, #start_file, #start_method
Instance Method Details
#after_class_error(ex) ⇒ Object
29
30
31
32
33
34
|
# File 'lib/micron/reporter/console.rb', line 29
def after_class_error(ex)
puts
puts indent(bar(underline("Error during after_class")))
puts indent(bar(Micron.dump_ex(ex, true)))
puts
end
|
#before_class_error(ex) ⇒ Object
22
23
24
25
26
27
|
# File 'lib/micron/reporter/console.rb', line 22
def before_class_error(ex)
puts
puts indent(bar(underline("Error during before_class; skipping tests")))
puts indent(bar(Micron.dump_ex(ex, true)))
puts
end
|
#end_class(clazz) ⇒ Object
87
88
89
|
# File 'lib/micron/reporter/console.rb', line 87
def end_class(clazz)
puts
end
|
#end_method(m) ⇒ Object
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/micron/reporter/console.rb', line 36
def end_method(m)
name = m.name.to_s
duration = sprintf("%0.3f", m.total_duration)
status = m.status.upcase
str = ralign(indent(name), "#{duration} #{status}")
if m.skipped? then
str.gsub!(/#{status}$/, colorize(status, :yellow))
elsif m.passed? then
str.gsub!(/#{status}$/, colorize(status, :green))
else
str.gsub!(/#{status}$/, colorize(status, :red))
end
puts str
if m.failed? and !m.skipped? then
puts
puts indent(underline("Exception:"))
if m.ex.kind_of? Array then
m.ex.each{ |ex|
next if m.ex.nil?
puts indent(Micron.dump_ex(ex, true))
puts
}
elsif m.ex.nil? then
puts indent("nil")
puts
else
puts indent(Micron.dump_ex(m.ex, true))
puts
end
if not m.stdout.empty? then
puts indent(underline("STDOUT:"))
puts indent(m.stdout.rstrip)
puts
end
if not m.stderr.empty? then
puts indent(underline("STDERR:"))
puts indent(m.stderr.rstrip)
puts
end
end
end
|
#end_tests(files, results) ⇒ Object
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
128
129
130
131
132
133
134
|
# File 'lib/micron/reporter/console.rb', line 91
def end_tests(files, results)
@runtime.stop
total = pass = fail = skip = 0
total_duration = 0.0
total_assertions = 0
results.each { |c|
c.methods.each { |m|
total += 1
total_duration += m.total_duration
total_assertions += m.assertions
if m.skipped? then
skip += 1
elsif m.passed? then
pass += 1
else
fail += 1
end
}
}
total_duration = sprintf("%0.3f", total_duration)
real_runtime = sprintf("%0.3f", @runtime.duration)
puts
puts divider(fail > 0 ? :red : (skip > 0 ? :yellow : :green))
puts " PASS: #{pass}, FAIL: #{fail}, SKIP: #{skip}"
puts " TOTAL: #{total} with #{total_assertions} assertions in #{total_duration} seconds (wall time: #{real_runtime})"
if fail > 0 then
puts
puts " Failed tests:"
results.each { |c|
c.methods.each { |m|
if !m.skipped? and m.failed? then
puts " #{c.name}##{m.name}"
end
}
}
end
puts divider(fail > 0 ? :red : (skip > 0 ? :yellow : :green))
end
|
#start_class(clazz) ⇒ Object
18
19
20
|
# File 'lib/micron/reporter/console.rb', line 18
def start_class(clazz)
puts clazz.name
end
|
#start_tests(files) ⇒ Object
10
11
12
13
14
15
16
|
# File 'lib/micron/reporter/console.rb', line 10
def start_tests(files)
@runtime = Hitimes::Interval.now
puts "="*CONSOLE_WIDTH
puts ralign("START TESTS (#{files.size} files)", "#{Time.new}")
puts "="*CONSOLE_WIDTH
puts
end
|