Class: QED::Reporter::Linear
Overview
Linear reporter limits each step to a single line.
Constant Summary
Constants inherited
from Abstract
Abstract::INFO_SIGNAL
Instance Attribute Summary
Attributes inherited from Abstract
#io, #record, #session
Instance Method Summary
collapse
Methods inherited from Abstract
After, Before, When, #after_demo, #after_eval, #after_import, #after_proc, #after_step, #before_eval, #before_import, #before_proc, #before_step, #call, #count_demo, #count_error, #count_fail, #count_pass, #count_step, #demo, #demos, #errors, #eval, #fails, #import, #initialize, #omits, #passes, #proc, #rule, #step, #steps, #success?, #trace?
Instance Method Details
#after_session(session) ⇒ Object
88
89
90
91
92
|
# File 'lib/qed/reporter/linear.rb', line 88
def after_session(session)
puts "[INFO] %s demos, %s steps: %s failures, %s errors (%s/%s assertions)" % get_tally
puts "[INFO] Finished in %.5f seconds." % [Time.now - @start_time]
puts "[INFO] End Session @ #{Time.now}".ansi(:bold)
end
|
#before_applique(step) ⇒ Object
25
26
27
28
29
30
31
32
|
# File 'lib/qed/reporter/linear.rb', line 25
def before_applique(step)
super(step)
str = "[NOTE] #{step.explain.gsub(/\s+/,' ')} "[0,@width]
pad = @width - str.size + 1
print str + (' ' * pad)
puts "[#{timestamp}]"
end
|
#before_demo(demo) ⇒ Object
19
20
21
22
|
# File 'lib/qed/reporter/linear.rb', line 19
def before_demo(demo)
file = localize_file(demo.file)
puts "[DEMO] #{file}".ansi(:bold)
end
|
#before_session(session) ⇒ Object
12
13
14
15
16
|
# File 'lib/qed/reporter/linear.rb', line 12
def before_session(session)
@width = ANSI::Terminal.terminal_width - 12
@start_time = Time.now
puts "[INFO] Session @ #{Time.now}".ansi(:bold)
end
|
#error(step, exception) ⇒ Object
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
# File 'lib/qed/reporter/linear.rb', line 67
def error(step, exception)
super(step, exception)
print_step(step, 'ERRO', :red)
s = []
s << assertion.class.name
s << assertion.message
backtrace = sane_backtrace(assertion)
backtrace.each do |bt|
s << bt
s << code_snippet(bt)
end
puts s.join("\n").tabto(8)
end
|
#fail(step, assertion) ⇒ Object
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
# File 'lib/qed/reporter/linear.rb', line 46
def fail(step, assertion)
super(step, assertion)
print_step(step, 'FAIL', :red)
s = []
s << assertion.class.name
s << assertion.message
backtrace = sane_backtrace(assertion)
backtrace.each do |bt|
s << bt
s << code_snippet(bt)
end
puts s.join("\n").tabto(8)
end
|
#pass(step) ⇒ Object
35
36
37
38
39
40
41
42
43
|
# File 'lib/qed/reporter/linear.rb', line 35
def pass(step)
super(step)
print_step(step, 'PASS', :green)
end
|