minitest-red_green 0.9.0 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -1
- data/bin/test_runner +1 -1
- data/lib/minitest/red_green/version.rb +1 -1
- data/lib/minitest/red_green.rb +8 -0
- data/lib/minitest/red_green_plugin.rb +2 -50
- 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: f767a35feb2b4140858612016de97ff005b66701
|
4
|
+
data.tar.gz: 1789ce356738eb9835b80b4993773861a8bd1301
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 02e90c93b7214fabf3326991d1e533090553178d57d8fface8ab14f71c99187163242b781faa29ec0eeceae735bfc8bbccf0c34a33e669173b68d461cc559cea
|
7
|
+
data.tar.gz: e40bb5c141a7f5d550115b9a75ead5be1c3b82565e9477204f397ff9262b1d0ae58dda217cbe0da6888da12da7417e7368bc72ad1fad23c000bbc4c394a213f2
|
data/README.md
CHANGED
@@ -10,6 +10,13 @@ Add this line to your application's Gemfile:
|
|
10
10
|
gem 'minitest-red_green'
|
11
11
|
```
|
12
12
|
|
13
|
+
Or your gem's gemspec:
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
spec.add_development_dependency 'minitest'
|
17
|
+
spec.add_development_dependency 'minitest-red_green'
|
18
|
+
```
|
19
|
+
|
13
20
|
And then execute:
|
14
21
|
|
15
22
|
$ bundle
|
@@ -23,7 +30,7 @@ Or install it yourself as:
|
|
23
30
|
Once you add this gem to your `Gemfile`, minitest should start printing out red and green colors. If you wish to disable this for some reason,
|
24
31
|
|
25
32
|
```ruby
|
26
|
-
Minitest::
|
33
|
+
Minitest::RedGreen.disabled = true
|
27
34
|
```
|
28
35
|
|
29
36
|
Although, it's probably much simpler to simply remove this gem from your `Gemfile` in the first place :)
|
data/bin/test_runner
CHANGED
data/lib/minitest/red_green.rb
CHANGED
@@ -1,57 +1,9 @@
|
|
1
1
|
module Minitest
|
2
2
|
def self.plugin_red_green_init options
|
3
|
-
return if
|
3
|
+
return if RedGreen.disabled
|
4
4
|
reporters = self.reporter.reporters.grep Minitest::Reporter
|
5
5
|
reporters.each do |reporter|
|
6
|
-
reporter.io =
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
|
-
class RedGreenPlugin
|
11
|
-
singleton_class.send :attr_accessor, :disabled
|
12
|
-
|
13
|
-
attr_accessor :sync
|
14
|
-
|
15
|
-
ESC = "\e["
|
16
|
-
|
17
|
-
def initialize io
|
18
|
-
@io = io
|
19
|
-
end
|
20
|
-
|
21
|
-
def puts *strings
|
22
|
-
if not strings.grep(%r{\d+\) (?:Failure|Error)}).empty?
|
23
|
-
strings.map! &method(:red)
|
24
|
-
end
|
25
|
-
@io.puts *strings
|
26
|
-
end
|
27
|
-
|
28
|
-
def print str
|
29
|
-
@io.print filter_test_output_chars str
|
30
|
-
end
|
31
|
-
|
32
|
-
def filter_test_output_chars str
|
33
|
-
case str
|
34
|
-
when '.' then green str
|
35
|
-
when 'E', 'F' then red str
|
36
|
-
when 'S' then yellow str
|
37
|
-
else str
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
def green str
|
42
|
-
colorize str, 32
|
43
|
-
end
|
44
|
-
|
45
|
-
def red str
|
46
|
-
colorize str, 31
|
47
|
-
end
|
48
|
-
|
49
|
-
def yellow str
|
50
|
-
colorize str, 33
|
51
|
-
end
|
52
|
-
|
53
|
-
def colorize str, col_code
|
54
|
-
"#{ESC}#{col_code}m#{str}#{ESC}0m"
|
6
|
+
reporter.io = RedGreen::Plugin.new options[:io]
|
55
7
|
end
|
56
8
|
end
|
57
9
|
end
|