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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 85c768217355836afe6702b768dd3e16b6b00c6e
4
- data.tar.gz: b60f591c141fe04e73793f1c78881fd20dad5328
3
+ metadata.gz: e50d405155a26fc68eb840c0e9c60359858826bb
4
+ data.tar.gz: bff03285b9da640ebe0a99cb918e1003b82af960
5
5
  SHA512:
6
- metadata.gz: 92adead9743b98fe37ad4269d9a9a9cb58a1d2acbc507defc927475142618d22d3254d49816977ba3c14f8787a02feae40a951f36445b3551625dcc2d6de33d7
7
- data.tar.gz: 84f3a148f315112a747a86b57c5ea600020c21f3431b67143cd3c31b6177c7c47d3f194a0e3a67d7538014a940d719e6be3dfe735553ff13e9f4f29f821f6d52
6
+ metadata.gz: 86e1538bb9fcac2f95d3feba65ab0596c692d768b8b93b4bcb33548961d172655852c31fa96906aa07d1c539a3657694dcab0bfc5b43254702d9d03856ce7304
7
+ data.tar.gz: d120c59b99239e9930d59e5d08bff9fccb4e311fe247294c318b4dbd6df6fb27106f92c5b8d44c13e9f8a89e46e5205f2c55efe2229f902058d8aa9ce9eb9023
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- minitest-doc_reporter (0.5.0)
4
+ minitest-doc_reporter (0.6.0)
5
5
  ansi
6
6
  minitest (~> 5.0)
7
7
 
data/README.md CHANGED
@@ -1,7 +1,6 @@
1
1
  # minitest-doc-reporter
2
2
 
3
-
4
- [![Gem Version](https://badge.fury.io/rb/gemfury.png)](http://badge.fury.io/rb/gemfury)
3
+ [![Gem Version](https://badge.fury.io/rb/minitest-doc_reporter.png)]
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.class)
33
+ puts format_header(result)
33
34
  puts format_result(result)
34
35
  puts
35
36
 
36
- if result.error?
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
- self.results << result if not result.passed? or result.skipped?
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
- pad(ANSI.bold {e.class.to_s} + "\n" + pad(e.message.to_s) + "\n" + \
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
- pad output
100
+ bt.each {|l| output << pad(l)}
101
+ output
95
102
  end
96
103
 
97
104
  def format_result(result)
98
105
  output = ""
99
- if result.passed?
100
- output = ANSI.green {result.name}
106
+ name = format_test_description result
107
+
108
+ if result.passed?
109
+ output = ANSI.green {name}
101
110
  else
102
- output = ANSI.red {result.name}
111
+ output = ANSI.red {name}
103
112
  end
113
+
104
114
  pad output
105
115
  end
106
116
 
107
- def format_header(header)
108
- ANSI.bold(header)
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 "#{count} tests run in #{total_time}"
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)
@@ -1,5 +1,5 @@
1
1
  module Minitest
2
2
  module DocReporter
3
- VERSION = "0.5.0"
3
+ VERSION = "0.6.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minitest-doc_reporter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Thompson