| 1 |
module Minitest |
| 2 |
module Reporters |
| 3 |
# Simple reporter designed for RubyMate. |
| 4 |
class RubyMateReporter < BaseReporter |
| 5 |
include RelativePosition |
| 6 |
|
| 7 |
INFO_PADDING = 2 |
| 8 |
|
| 9 |
def start |
| 10 |
super |
| 11 |
puts('Started with run options %s' % options[:args]) |
| 12 |
puts |
| 13 |
end |
| 14 |
|
| 15 |
def record(test) |
| 16 |
super |
| 17 |
if test.skipped? |
| 18 |
print 'SKIP' |
| 19 |
print_test_with_time(test) |
| 20 |
puts |
| 21 |
puts |
| 22 |
elsif test.error? |
| 23 |
print 'ERROR' |
| 24 |
print_test_with_time(test) |
| 25 |
puts |
| 26 |
print_info(test.failure) |
| 27 |
puts |
| 28 |
elsif test.failure |
| 29 |
print 'FAIL' |
| 30 |
print_test_with_time(test) |
| 31 |
puts |
| 32 |
print_info(test.failure, false) |
| 33 |
puts |
| 34 |
end |
| 35 |
end |
| 36 |
|
| 37 |
def report |
| 38 |
super |
| 39 |
puts |
| 40 |
puts('Finished in %.5fs' % total_time) |
| 41 |
print('%d tests, %d assertions, ' % [count, assertions]) |
| 42 |
print('%d failures, %d errors, ' % [failures, errors]) |
| 43 |
print('%d skips' % skips) |
| 44 |
puts |
| 45 |
end |
| 46 |
|
| 47 |
private |
| 48 |
|
| 49 |
def print_test_with_time(test) |
| 50 |
print(" #{test.class}##{test.name} (%.2fs)" % test.time) |
| 51 |
end |
| 52 |
end |
| 53 |
end |
| 54 |
end |