minitest-utils 0.1.2 → 0.1.3
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/lib/minitest/utils/reporter.rb +20 -28
- data/lib/minitest/utils/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a3d7eacdc6f99419e24d644628d2ce2bd8b034b5
|
4
|
+
data.tar.gz: c2640e2eaf4dad798ad8ce8f329214ced19cf523
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7fb4411e84f444f31511a7a5be6329c3c2d6433cc763bedcf40250c0c66fc96ba9fecb338fec078127d5ec2644645e9e6752967eb0b60135c08d1e2bb703a41e
|
7
|
+
data.tar.gz: 05e09091d4f8826a3d193c651f1be8b9cbc03c5860cac8324a1b2311c9ec6ae224e71b27ff67a6372cf1fad9b0ab8f28479a0ebe4bc97597f45d373d37f96121
|
@@ -1,8 +1,22 @@
|
|
1
1
|
module Minitest
|
2
2
|
module Utils
|
3
3
|
class Reporter < Minitest::StatisticsReporter
|
4
|
+
COLOR_FOR_RESULT_CODE = {
|
5
|
+
'.' => :green,
|
6
|
+
'E' => :red,
|
7
|
+
'F' => :red,
|
8
|
+
'S' => :yellow
|
9
|
+
}
|
10
|
+
|
11
|
+
COLOR = {
|
12
|
+
red: 31,
|
13
|
+
green: 32,
|
14
|
+
yellow: 33,
|
15
|
+
blue: 34
|
16
|
+
}
|
17
|
+
|
4
18
|
def statistics
|
5
|
-
|
19
|
+
super
|
6
20
|
end
|
7
21
|
|
8
22
|
def record(result)
|
@@ -89,7 +103,7 @@ module Minitest
|
|
89
103
|
|
90
104
|
def find_test_file(result)
|
91
105
|
filter_backtrace(result.failure.backtrace)
|
92
|
-
.find {|line| line.match(%r(
|
106
|
+
.find {|line| line.match(%r((test|spec)/.*?_(test|spec).rb)) }
|
93
107
|
.gsub(/:\d+.*?$/, '')
|
94
108
|
end
|
95
109
|
|
@@ -113,40 +127,18 @@ module Minitest
|
|
113
127
|
|
114
128
|
def result_name(name)
|
115
129
|
name
|
116
|
-
.gsub(/^
|
130
|
+
.gsub(/^test(_\d+)?_/, '')
|
117
131
|
.gsub(/_/, ' ')
|
118
132
|
end
|
119
133
|
|
120
134
|
def print_result_code(result_code)
|
121
|
-
result_code =
|
122
|
-
when '.'
|
123
|
-
color('.', :green)
|
124
|
-
when 'S'
|
125
|
-
color('S', :yellow)
|
126
|
-
when 'F'
|
127
|
-
color('F', :red)
|
128
|
-
when 'E'
|
129
|
-
color('E', :red)
|
130
|
-
else
|
131
|
-
color(result_code)
|
132
|
-
end
|
133
|
-
|
135
|
+
result_code = color(result_code, COLOR_FOR_RESULT_CODE[result_code])
|
134
136
|
io.print result_code
|
135
137
|
end
|
136
138
|
|
137
139
|
def color(string, color = :default)
|
138
|
-
|
139
|
-
|
140
|
-
"\e[31m#{string}\e[0m"
|
141
|
-
when :green
|
142
|
-
"\e[32m#{string}\e[0m"
|
143
|
-
when :yellow
|
144
|
-
"\e[33m#{string}\e[0m"
|
145
|
-
when :blue
|
146
|
-
"\e[34m#{string}\e[0m"
|
147
|
-
else
|
148
|
-
"\e[0m#{string}"
|
149
|
-
end
|
140
|
+
color = COLOR.fetch(color, 0)
|
141
|
+
"\e[#{color}m#{string}"
|
150
142
|
end
|
151
143
|
|
152
144
|
def pluralize(word, count)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minitest-utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nando Vieira
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|