minitest-utils 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2e05b2ac23684f1e18f9041e435ffbb208e20298
4
- data.tar.gz: 2fde7a6d2dc9aab27ea5bac439dc13351b8e0a36
3
+ metadata.gz: 4133da410c70092ff9e63a0d169364a74776ea40
4
+ data.tar.gz: 3217e7fb9c40e60b281f16045652caeeeaf6cfc9
5
5
  SHA512:
6
- metadata.gz: 7408e2d383242fdbb7d2d9a5eb25cce5203fa2141f2e33368fc012116e2c771d8f01f33813d3246ef016ae7955b085de33a3d5c2a2d2783ba20d646536aa6fa0
7
- data.tar.gz: cb472e1b97e50b6572a05144066ed647298442107b1165f09a5c8d5f5cb5c6205d032929048dd30f73159fde9e28170dc6c3ee1b8faf6e445940800ad37b5536
6
+ metadata.gz: a949dc3addeeac7e97b6c13b16d7323230bb5e9660e388ffeaa9cba2916f4ee5b322f731cf00631ea1b33c6f1a4911a62de53f311163724dd5fd5754ba80d461
7
+ data.tar.gz: e9d78f5d7c79e7d815cb42cb8692a0622f8db836326d92162017b95fc325b154e5f111c2b6ac267f52716da815a4507909aa50d053bb1224b4af6d554de9a720
@@ -15,6 +15,11 @@ module Minitest
15
15
  blue: 34
16
16
  }
17
17
 
18
+ def initialize(*)
19
+ super
20
+ @color_enabled = io.respond_to?(:tty?) && io.tty?
21
+ end
22
+
18
23
  def statistics
19
24
  super
20
25
  end
@@ -141,8 +146,16 @@ module Minitest
141
146
  end
142
147
 
143
148
  def color(string, color = :default)
144
- color = COLOR.fetch(color, 0)
145
- "\e[#{color}m#{string}\e[0m"
149
+ if color_enabled?
150
+ color = COLOR.fetch(color, 0)
151
+ "\e[#{color}m#{string}\e[0m"
152
+ else
153
+ string
154
+ end
155
+ end
156
+
157
+ def color_enabled?
158
+ @color_enabled
146
159
  end
147
160
 
148
161
  def pluralize(word, count)
@@ -1,5 +1,5 @@
1
1
  module Minitest
2
2
  module Utils
3
- VERSION = '0.2.0'
3
+ VERSION = '0.2.1'
4
4
  end
5
5
  end
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.2.0
4
+ version: 0.2.1
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-31 00:00:00.000000000 Z
11
+ date: 2015-06-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest