Class: MiniTest::Reporters::SpecReporter
- Inherits:
-
Object
- Object
- MiniTest::Reporters::SpecReporter
show all
- Includes:
- ANSI::Code, MiniTest::Reporter
- Defined in:
- lib/minitest/reporters/spec_reporter.rb
Overview
Turn-like reporter that reads like a spec.
Based upon TwP's turn (MIT License) and paydro's monkey-patch.
Constant Summary
collapse
- TEST_PADDING =
2
- INFO_PADDING =
8
- MARK_SIZE =
5
Instance Method Summary
collapse
-
#after_suite(suite)
-
#after_suites(suites, type)
-
#before_suite(suite)
-
#before_suites(suites, type)
-
#error(suite, test, test_runner)
-
#failure(suite, test, test_runner)
-
#initialize(backtrace_filter = BacktraceFilter.default_filter) ⇒ SpecReporter
constructor
A new instance of SpecReporter.
-
#pass(suite, test, test_runner)
-
#skip(suite, test, test_runner)
#before_test, #output, #print, #puts, #runner, #verbose?
Constructor Details
#initialize(backtrace_filter = BacktraceFilter.default_filter) ⇒ SpecReporter
Returns a new instance of SpecReporter.
19
20
21
|
# File 'lib/minitest/reporters/spec_reporter.rb', line 19
def initialize(backtrace_filter = BacktraceFilter.default_filter)
@backtrace_filter = backtrace_filter
end
|
Instance Method Details
#after_suite(suite)
42
43
44
|
# File 'lib/minitest/reporters/spec_reporter.rb', line 42
def after_suite(suite)
puts
end
|
#after_suites(suites, type)
28
29
30
31
32
33
34
35
36
|
# File 'lib/minitest/reporters/spec_reporter.rb', line 28
def after_suites(suites, type)
total_time = Time.now - runner.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_suite(suite)
38
39
40
|
# File 'lib/minitest/reporters/spec_reporter.rb', line 38
def before_suite(suite)
puts suite.name
end
|
#before_suites(suites, type)
23
24
25
26
|
# File 'lib/minitest/reporters/spec_reporter.rb', line 23
def before_suites(suites, type)
puts 'Started'
puts
end
|
#error(suite, test, test_runner)
66
67
68
69
70
71
72
|
# File 'lib/minitest/reporters/spec_reporter.rb', line 66
def error(suite, test, test_runner)
print(red { pad_mark('ERROR') })
print_test_with_time(test)
puts
print_info(test_runner.exception)
puts
end
|
#failure(suite, test, test_runner)
58
59
60
61
62
63
64
|
# File 'lib/minitest/reporters/spec_reporter.rb', line 58
def failure(suite, test, test_runner)
print(red { pad_mark('FAIL') })
print_test_with_time(test)
puts
print_info(test_runner.exception)
puts
end
|
#pass(suite, test, test_runner)
46
47
48
49
50
|
# File 'lib/minitest/reporters/spec_reporter.rb', line 46
def pass(suite, test, test_runner)
print(green { pad_mark('PASS') })
print_test_with_time(test)
puts
end
|
#skip(suite, test, test_runner)
52
53
54
55
56
|
# File 'lib/minitest/reporters/spec_reporter.rb', line 52
def skip(suite, test, test_runner)
print(yellow { pad_mark('SKIP') })
print_test_with_time(test)
puts
end
|