Class: Turn::OutlineReporter
Overview
Outline Reporter (Turn’s Original)
– TODO: Should we fit reporter output to width of console? TODO: Running percentages? ++
Constant Summary
Constants included
from Colorize
Colorize::COLORIZE, Colorize::ERROR, Colorize::FAIL, Colorize::PASS
Instance Attribute Summary
Attributes inherited from Reporter
#io
Instance Method Summary
collapse
Methods inherited from Reporter
#finish_case, #initialize
Constructor Details
This class inherits a constructor from Turn::Reporter
Instance Method Details
#error(message = nil) ⇒ Object
51
52
53
54
|
# File 'lib/turn/reporters/outline_reporter.rb', line 51
def error(message=nil)
io.puts("#{ERROR}")
io.puts(message.to_s) if message
end
|
#fail(message = nil) ⇒ Object
42
43
44
45
46
47
48
49
|
# File 'lib/turn/reporters/outline_reporter.rb', line 42
def fail(message=nil)
io.puts(" #{FAIL}")
if message
message = ::ANSICode.magenta(message) if COLORIZE
message = message.to_s.tabto(8)
io.puts(message)
end
end
|
#finish_suite(suite) ⇒ Object
def finish_case(kase) end
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
# File 'lib/turn/reporters/outline_reporter.rb', line 62
def finish_suite(suite)
total = suite.count_tests
failure = suite.count_failures
error = suite.count_errors
pass = total - failure - error
bar = '=' * 78
if COLORIZE
bar = if pass == total then ::ANSICode.green bar
else ::ANSICode.red bar end
end
tally = [total, suite.count_assertions]
io.puts bar
io.puts " pass: %d, fail: %d, error: %d" % [pass, failure, error]
io.puts " total: %d tests with %d assertions in #{Time.new - @time} seconds" % tally
io.puts bar
end
|
#finish_test(test) ⇒ Object
56
57
|
# File 'lib/turn/reporters/outline_reporter.rb', line 56
def finish_test(test)
end
|
#pass(message = nil) ⇒ Object
33
34
35
36
37
38
39
40
|
# File 'lib/turn/reporters/outline_reporter.rb', line 33
def pass(message=nil)
io.puts " #{PASS}"
if message
message = ::ANSICode.magenta(message) if COLORIZE
message = message.to_s.tabto(8)
io.puts(message)
end
end
|
#start_case(kase) ⇒ Object
21
22
23
|
# File 'lib/turn/reporters/outline_reporter.rb', line 21
def start_case(kase)
io.puts(kase.name)
end
|
#start_suite(suite) ⇒ Object
13
14
15
16
17
18
19
|
# File 'lib/turn/reporters/outline_reporter.rb', line 13
def start_suite(suite)
@suite = suite
@time = Time.now
io.puts "Loaded suite #{suite.name}"
end
|
#start_test(test) ⇒ Object
25
26
27
28
29
30
31
|
# File 'lib/turn/reporters/outline_reporter.rb', line 25
def start_test(test)
io.print " %-69s" % test.name
end
|