-
Notifications
You must be signed in to change notification settings - Fork 22
/
default.cr
68 lines (56 loc) · 1.51 KB
/
default.cr
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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
module Spec2
module Reporters
class Default
include Reporter
extend Reporter::Factory
def self.build
new
end
getter! output
def initialize
@count = 0
@pending = 0
@errors = [] of ExpectationNotMet
end
def configure_output(@output : Output)
end
def context_started(context)
end
def context_finished(context)
end
def example_started(example)
@count += 1
end
def example_succeeded(example)
if example.pending?
@pending += 1
output.print :pending, "*"
else
output.print :success, "."
end
end
def example_failed(example, exception)
@errors << exception
output.print :failure, "F"
end
def example_errored(example, exception)
@errors << exception
output.print :failure, puts "E"
end
def report
output.puts
@errors.each do |e|
example = e.example.not_nil!
output.puts
output.puts :failure, "In example: #{example.description}"
output.puts :failure, "\tFailure: #{e}"
output.puts :failure, e.backtrace.map { |line| "\t#{line}" }.join("\n")
end
output.puts
status = @errors.size > 0 ? :failure : :success
output.puts "Finished in #{ElapsedTime.new.to_s}"
output.puts status, "Examples: #{@count}, failures: #{@errors.size}, pending: #{@pending}"
end
end
end
end