Class: Journo::Reporters::ProgressReporter
Overview
Fuubar-like reporter with a progress bar.
Based upon Jeff Kreefmeijer's Fuubar (MIT License) and paydro's
monkey-patch.
Constant Summary
collapse
- INFO_PADDING =
2
Journo::Reporter::VERSION
Instance Method Summary
collapse
-
#after_suites(suites, type)
-
#before_suites(suites, type)
-
#error(suite, test, test_runner)
-
#failure(suite, test, test_runner)
-
#increment
-
#pass(suite, test, test_runner)
-
#skip(suite, test, test_runner)
#after_suite, #before_suite, #before_test, #output, #print, #puts, #runner, #verbose?
Instance Method Details
#after_suites(suites, type)
69
70
71
72
73
74
75
76
77
78
79
80
|
# File 'lib/journo/reporters/progress_reporter.rb', line 69
def after_suites(suites, type)
with_color { @progress.finish }
total_time = Time.now - runner.start_time
puts
puts('Finished in %.5fs' % total_time)
print('%d tests, %d assertions, ' % [runner.test_count, runner.assertion_count])
print(red { '%d failures, %d errors, ' } % [runner.failures, runner.errors])
print(yellow { '%d skips' } % runner.skips)
puts
end
|
#before_suites(suites, type)
18
19
20
21
22
23
24
25
26
|
# File 'lib/journo/reporters/progress_reporter.rb', line 18
def before_suites(suites, type)
puts 'Started'
puts
@color = GREEN
@finished_count = 0
@progress = ProgressBar.new("0/#{runner.test_count}", runner.test_count, runner.output)
@progress.bar_mark = '='
end
|
#error(suite, test, test_runner)
59
60
61
62
63
64
65
66
67
|
# File 'lib/journo/reporters/progress_reporter.rb', line 59
def error(suite, test, test_runner)
@color = RED
print(red { 'ERROR' })
print_test_with_time(suite, test)
puts
print_info(test_runner.exception)
puts
increment
end
|
#failure(suite, test, test_runner)
49
50
51
52
53
54
55
56
57
|
# File 'lib/journo/reporters/progress_reporter.rb', line 49
def failure(suite, test, test_runner)
@color = RED
print(red { 'FAIL' })
print_test_with_time(suite, test)
puts
print_info(test_runner.exception)
puts
increment
end
|
#increment
28
29
30
31
32
33
34
|
# File 'lib/journo/reporters/progress_reporter.rb', line 28
def increment
with_color do
@finished_count += 1
@progress.instance_variable_set('@title', "#{@finished_count}/#{runner.test_count}")
@progress.inc
end
end
|
#pass(suite, test, test_runner)
36
37
38
|
# File 'lib/journo/reporters/progress_reporter.rb', line 36
def pass(suite, test, test_runner)
increment
end
|
#skip(suite, test, test_runner)
40
41
42
43
44
45
46
47
|
# File 'lib/journo/reporters/progress_reporter.rb', line 40
def skip(suite, test, test_runner)
@color = YELLOW unless @color == RED
print(yellow { 'SKIP' })
print_test_with_time(suite, test)
puts
puts
increment
end
|