minitest-doc_reporter 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +1 -2
- data/lib/minitest/doc_reporter.rb +40 -23
- data/lib/minitest/doc_reporter/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e50d405155a26fc68eb840c0e9c60359858826bb
|
4
|
+
data.tar.gz: bff03285b9da640ebe0a99cb918e1003b82af960
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 86e1538bb9fcac2f95d3feba65ab0596c692d768b8b93b4bcb33548961d172655852c31fa96906aa07d1c539a3657694dcab0bfc5b43254702d9d03856ce7304
|
7
|
+
data.tar.gz: d120c59b99239e9930d59e5d08bff9fccb4e311fe247294c318b4dbd6df6fb27106f92c5b8d44c13e9f8a89e46e5205f2c55efe2229f902058d8aa9ce9eb9023
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
# minitest-doc-reporter
|
2
2
|
|
3
|
-
|
4
|
-
[](http://badge.fury.io/rb/gemfury)
|
3
|
+
[]
|
5
4
|
|
6
5
|
A more detailed reporter for minitest inspired by the documentation output of
|
7
6
|
Rspec.
|
@@ -25,29 +25,21 @@ module Minitest
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def start
|
28
|
+
puts
|
28
29
|
self.start_time = Time.now
|
29
30
|
end
|
30
31
|
|
31
32
|
def record(result)
|
32
|
-
puts format_header(result
|
33
|
+
puts format_header(result)
|
33
34
|
puts format_result(result)
|
34
35
|
puts
|
35
36
|
|
36
|
-
|
37
|
-
puts format_error_info(result)
|
38
|
-
puts
|
39
|
-
end
|
40
|
-
|
41
|
-
if result.failure
|
42
|
-
puts pad(result.failure.to_s)
|
43
|
-
puts
|
44
|
-
end
|
45
|
-
|
46
|
-
self.count += 1
|
37
|
+
puts failure_info(result) unless result.passed?
|
47
38
|
|
48
|
-
|
39
|
+
update_statistics(result)
|
49
40
|
end
|
50
41
|
|
42
|
+
|
51
43
|
def report
|
52
44
|
super
|
53
45
|
|
@@ -66,6 +58,21 @@ module Minitest
|
|
66
58
|
|
67
59
|
private
|
68
60
|
|
61
|
+
def failure_info(result)
|
62
|
+
if result.error?
|
63
|
+
puts pad(format_error_info(result))
|
64
|
+
puts
|
65
|
+
elsif result.failure
|
66
|
+
result.failure.to_s.each_line {|l| puts pad(l)}
|
67
|
+
puts
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
def update_statistics(result)
|
72
|
+
self.count += 1
|
73
|
+
self.results << result unless result.passed? || result.skipped?
|
74
|
+
end
|
75
|
+
|
69
76
|
def statistics
|
70
77
|
"#{format_result_type('Errors', errors, :red)} #{format_divider}" + \
|
71
78
|
"#{format_result_type('Failures', failures, :red)} #{format_divider}" + \
|
@@ -84,32 +91,42 @@ module Minitest
|
|
84
91
|
def format_error_info(result)
|
85
92
|
e = result.failure.exception
|
86
93
|
bt = Minitest.filter_backtrace e.backtrace
|
87
|
-
|
88
|
-
format_backtrace(bt)
|
94
|
+
ANSI.bold {e.class.to_s} + "\n" + pad(e.message.to_s) + "\n" + \
|
95
|
+
format_backtrace(bt)
|
89
96
|
end
|
90
97
|
|
91
98
|
def format_backtrace(bt)
|
92
99
|
output = ""
|
93
|
-
bt.each {|l| output << l}
|
94
|
-
|
100
|
+
bt.each {|l| output << pad(l)}
|
101
|
+
output
|
95
102
|
end
|
96
103
|
|
97
104
|
def format_result(result)
|
98
105
|
output = ""
|
99
|
-
|
100
|
-
|
106
|
+
name = format_test_description result
|
107
|
+
|
108
|
+
if result.passed?
|
109
|
+
output = ANSI.green {name}
|
101
110
|
else
|
102
|
-
output = ANSI.red {
|
111
|
+
output = ANSI.red {name}
|
103
112
|
end
|
113
|
+
|
104
114
|
pad output
|
105
115
|
end
|
106
116
|
|
107
|
-
def
|
108
|
-
|
117
|
+
def format_test_description(result)
|
118
|
+
verb = result.name.split[0].split("_").last
|
119
|
+
phrase = result.name.split[1..-1].join " "
|
120
|
+
"#{verb} #{phrase}"
|
121
|
+
end
|
122
|
+
|
123
|
+
def format_header(result)
|
124
|
+
ANSI.bold(result.class)
|
109
125
|
end
|
110
126
|
|
111
127
|
def format_tests_run_count(count, total_time)
|
112
|
-
ANSI.bold
|
128
|
+
time = ANSI.bold total_time.to_s
|
129
|
+
"#{count} tests run in #{time} seconds."
|
113
130
|
end
|
114
131
|
|
115
132
|
def format_result_type(type, count, colour)
|