Class: MiniTest::Reporters::SpecReporter
Overview
Turn-like reporter that reads like a spec.
Based upon TwP's turn (MIT License) and paydro's monkey-patch.
Constant Summary
MiniTest::RelativePosition::INFO_PADDING, MiniTest::RelativePosition::MARK_SIZE, MiniTest::RelativePosition::TEST_PADDING, MiniTest::RelativePosition::TEST_SIZE
Instance Method Summary
collapse
-
#after_suite(suite)
-
#after_suites(suites, type)
-
#before_suites(suites, type)
-
#error(suite, test, test_runner)
-
#failure(suite, test, test_runner)
-
#initialize ⇒ SpecReporter
constructor
A new instance of SpecReporter.
-
#pass(suite, test, test_runner)
-
#skip(suite, test, test_runner)
#after_test, #before_suite, #before_test, #filter_backtrace, #output, #print, #puts, #runner, #verbose?
Constructor Details
Returns a new instance of SpecReporter.
16
17
18
|
# File 'lib/minitest/reporters/spec_reporter.rb', line 16
def initialize
@suites = []
end
|
Instance Method Details
#after_suite(suite)
35
36
37
|
# File 'lib/minitest/reporters/spec_reporter.rb', line 35
def after_suite(suite)
puts if @suites.include?(suite)
end
|
#after_suites(suites, type)
25
26
27
28
29
30
31
32
33
|
# File 'lib/minitest/reporters/spec_reporter.rb', line 25
def after_suites(suites, type)
total_time = Time.now - runner.suites_start_time
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)
20
21
22
23
|
# File 'lib/minitest/reporters/spec_reporter.rb', line 20
def before_suites(suites, type)
puts 'Started'
puts
end
|
#error(suite, test, test_runner)
65
66
67
68
69
70
71
72
73
|
# File 'lib/minitest/reporters/spec_reporter.rb', line 65
def error(suite, test, test_runner)
print_suite(suite) unless @suites.include?(suite)
print pad_test(test)
print(red { pad_mark('ERROR') })
print_time(test)
puts
print_info(test_runner.exception)
puts
end
|
#failure(suite, test, test_runner)
55
56
57
58
59
60
61
62
63
|
# File 'lib/minitest/reporters/spec_reporter.rb', line 55
def failure(suite, test, test_runner)
print_suite(suite) unless @suites.include?(suite)
print pad_test(test)
print(red { pad_mark('FAIL') })
print_time(test)
puts
print_info(test_runner.exception)
puts
end
|
#pass(suite, test, test_runner)
39
40
41
42
43
44
45
|
# File 'lib/minitest/reporters/spec_reporter.rb', line 39
def pass(suite, test, test_runner)
print_suite(suite) unless @suites.include?(suite)
print pad_test(test)
print(green { pad_mark('PASS') })
print_time(test)
puts
end
|
#skip(suite, test, test_runner)
47
48
49
50
51
52
53
|
# File 'lib/minitest/reporters/spec_reporter.rb', line 47
def skip(suite, test, test_runner)
print_suite(suite) unless @suites.include?(suite)
print pad_test(test)
print(yellow { pad_mark('SKIP') })
print_time(test)
puts
end
|