minitest-colorin 0.1.0 → 0.1.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: ac07cc5672ad5e29fb08203b4074ff87970c713e
4
- data.tar.gz: 427351fe794d88ec82f48113eabf62e8e9ea4d0a
3
+ metadata.gz: 4be2babd8a4657b6eac9494b001ce702cf2ac577
4
+ data.tar.gz: 6e5fa7d415e0a4339c6f8519008c13b9850f9fd9
5
5
  SHA512:
6
- metadata.gz: 3484e22641f9806eac23e9de7728c7fdd2b39b19e27e2368e560bce93435dc9f3d3b6c5b7936730787993ccf3d2ebe52ae2b970dc56bc0cffd059e1e5e57ff31
7
- data.tar.gz: cc1d85888fe006825ff295e64c84e693f3d24b20715b25153038bf9a719c30001e6671c82b9fa2ce3bba838e55d51cbf67d20da2a79a610a2ad867f27e1ca00f
6
+ metadata.gz: c59474a5bb16bc83613008bc93d1ee8fe1d495b40844f24fc9aaaaeadb1a17a0d044fca739648f7c4472bf84faa8889c7f12dfcd5dbf06e32883605d41388cdf
7
+ data.tar.gz: a70e1c202d2f3e987be2513f2609fcda6ba4b222534a20717959778f0f30ea06749cd7c7e6e26ad8104c6b29720169b6bb87be16959fa5db2b02f7b625f91715
@@ -62,20 +62,21 @@ module Minitest
62
62
 
63
63
  if test_id.context != @previous_context
64
64
  io.puts
65
- io.puts colorin(test_id.context).white.bold
65
+ io.puts ::Colorin.white(test_id.context).bold
66
66
  @previous_context = test_id.context
67
67
  end
68
68
 
69
- label = colorin(LABELS[result.result_code]).send COLORS[GROUPS[result.result_code]]
70
- number = colorin(test_id.number).dark
71
- time = colorin("(#{result.time.round(3)}s)").dark
72
- error = case result.result_code
73
- when 'E' then colorin("#{error_message(result)}").dark.send(COLORS[:errors])
74
- when 'F' then colorin("#{relative_path(result.failures[0].location)}").send(COLORS[:failures])
69
+ label = colorin(LABELS[result.result_code], GROUPS[result.result_code])
70
+ number = ::Colorin.dark(test_id.number)
71
+ time = ::Colorin.dark("(#{result.time.round(3)}s)")
72
+ message = case result.result_code
73
+ when 'S' then colorin(result.failures[0].message, :skips)
74
+ when 'F' then colorin(relative_path(result.failures[0].location), :failures)
75
+ when 'E' then colorin(error_message(result), :errors)
75
76
  else nil
76
77
  end
77
78
 
78
- io.puts " #{label} #{number} #{test_id.name} #{time} #{error}"
79
+ io.puts " #{label} #{number} #{test_id.name} #{time} #{message}"
79
80
  end
80
81
 
81
82
  def passed?
@@ -117,26 +118,25 @@ module Minitest
117
118
  end
118
119
 
119
120
  def print_detail_of(group)
120
- color = COLORS[group]
121
121
  group_results = send group
122
122
 
123
123
  if group_results.any?
124
- io.puts colorin(group.to_s.upcase).bold.underline.send(color)
124
+ io.puts colorin(group.to_s.upcase, group).bold.underline
125
125
  group_results.each_with_index do |r,i|
126
126
  test_id = TestID.new r
127
127
  number = "#{i+1}) "
128
128
  indent = ' ' * number.size
129
129
  io.puts "#{number}#{test_id.context} > #{test_id.name}"
130
130
  if group == :errors
131
- io.puts colorin("#{indent}#{r.failures[0].exception.class}: #{r.failures[0].exception.message}").send(color)
131
+ io.puts colorin("#{indent}#{r.failures[0].exception.class}: #{r.failures[0].exception.message}", group)
132
132
  r.failures[0].backtrace.each do |line|
133
- io.puts colorin("#{indent}#{relative_path(line)}").dark
133
+ io.puts ::Colorin.dark("#{indent}#{relative_path(line)}")
134
134
  end
135
135
  else
136
136
  r.failures[0].message.split("\n").each do |line|
137
- io.puts colorin("#{indent}#{line}").send(color)
137
+ io.puts colorin("#{indent}#{line}", group)
138
138
  end
139
- io.puts colorin("#{indent}#{relative_path(r.failures[0].location)}").dark
139
+ io.puts ::Colorin.dark("#{indent}#{relative_path(r.failures[0].location)}")
140
140
  end
141
141
  io.puts if i < group_results.count - 1
142
142
  end
@@ -146,12 +146,12 @@ module Minitest
146
146
 
147
147
  def print_summary
148
148
  summary = [
149
- colorin("#{results.count} tests").send(COLORS[:tests]),
150
- colorin("#{passed.count} passed").send(COLORS[:passed]),
151
- colorin("#{failures.count} failures").send(COLORS[:failures]),
152
- colorin("#{errors.count} errors").send(COLORS[:errors]),
153
- colorin("#{skips.count} skips").send(COLORS[:skips]),
154
- colorin("#{assertions_count} assertions").send(COLORS[:assertions]),
149
+ colorin("#{results.count} tests", :tests),
150
+ colorin("#{passed.count} passed", :passed),
151
+ colorin("#{failures.count} failures", :failures),
152
+ colorin("#{errors.count} errors", :errors),
153
+ colorin("#{skips.count} skips", :skips),
154
+ colorin("#{assertions_count} assertions", :assertions),
155
155
  ]
156
156
 
157
157
  io.puts summary.join(', ')
@@ -171,8 +171,8 @@ module Minitest
171
171
  full_path.gsub "#{Dir.pwd}/", ''
172
172
  end
173
173
 
174
- def colorin(text)
175
- ::Colorin.new text
174
+ def colorin(text, group)
175
+ ::Colorin.send COLORS[group], text
176
176
  end
177
177
 
178
178
  end
@@ -1,5 +1,5 @@
1
1
  module Minitest
2
2
  class Colorin
3
- VERSION = '0.1.0'
3
+ VERSION = '0.1.1'
4
4
  end
5
5
  end
@@ -4,7 +4,7 @@ module Minitest
4
4
  end
5
5
 
6
6
  def self.plugin_colorin_init(options)
7
- self.reporter.reporters = []
7
+ self.reporter.reporters.clear
8
8
  self.reporter << Colorin.new(options.fetch(:io, STDOUT))
9
9
  end
10
10
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minitest-colorin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gabriel Naiman