minitest-reporters 1.2.0.beta2 → 1.2.0.beta3

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: 62f787588456a19e8d7f3c259964eb08bb800cb6
4
- data.tar.gz: 57f0b830502a46809f639a0000ac6b465c94163f
3
+ metadata.gz: bf175a4bd5a5eb0b5d1869c69ea3be75678e0eb1
4
+ data.tar.gz: b54fba7927d3d3847672aa17389edb4a0f13f9c4
5
5
  SHA512:
6
- metadata.gz: 850a2e0aa57a50ff1603f4d4aab3904aa57a93eef0d126080879ce8fdac468d1c2dc95df58d1844387af3d79d10398c93653212390b2c5731587a7d8a175ebc3
7
- data.tar.gz: 7ee01ec3c6f529936d5d762c833980b45758d70b0b34321cb3f8a9a10dd2f48479c2ff674128d7c3cfc81faac330097e5c2eef494d6215b922712a65fd143097
6
+ metadata.gz: f35339a52b0c8b1eeec7d2eb1d2f5815700889fbc9e6235f5e53cafdf04a8776dbc6edd3587009670630a75ec2933b720d93fd91a53ef3d8653fc7342ccf5b71
7
+ data.tar.gz: 0c599e9cb7f21434ff2515027f31b473eccfa5acb912e912806b7bd60518e97e3b15c436c5c0cd8769a873cfe3e2585a183129e85a8dcf1e50e517bd4f624856
data/CHANGELOG.md CHANGED
@@ -1,4 +1,11 @@
1
- ### [v1.2.0.beta2](https://github.com/kern/minitest-reporters/compare/v1.2.0.beta1...v1.2.0.beta2)
1
+ ### [dev](https://github.com/kern/minitest-reporters/compare/v1.2.0.beta3...master)
2
+
3
+ ### [1.2.0.beta2](https://github.com/kern/minitest-reporters/compare/v1.2.0.beta2...v1.2.0.beta3)
4
+
5
+ * junit reporter changed to support mintest >= 5.11 [#252](https://github.com/kern/minitest-reporters/pull/252) (contributed by [Kevinrob](https://github.com/Kevinrob))
6
+ * all reporters changed to be compatible with minitest >= 5.11 (if not - report a bug ;)
7
+
8
+ ### [1.2.0.beta2](https://github.com/kern/minitest-reporters/compare/v1.2.0.beta1...v1.2.0.beta2)
2
9
 
3
10
  * fixed uninitialized time in junit reporter [#251](https://github.com/kern/minitest-reporters/issues/251)
4
11
  * format option added to progress reporter [#240](https://github.com/kern/minitest-reporters/pull/240) (contributed by [jorgesmu](https://github.com/jorgesmu))
@@ -63,6 +63,14 @@ module Minitest
63
63
  end
64
64
  end
65
65
 
66
+ def test_class(result)
67
+ if result.respond_to? :klass
68
+ result.klass
69
+ else
70
+ result.class
71
+ end
72
+ end
73
+
66
74
  def print_colored_status(test)
67
75
  if test.passed?
68
76
  print(green { pad_mark( result(test).to_s.upcase ) })
@@ -113,7 +113,7 @@ module Minitest
113
113
  puts
114
114
 
115
115
  slow_tests.each do |test|
116
- puts "%.6fs %s" % [test.time, "#{test.name}##{test.class}"]
116
+ puts "%.6fs %s" % [test.time, "#{test.name}##{test_class(test)}"]
117
117
  end
118
118
  end
119
119
 
@@ -125,7 +125,7 @@ module Minitest
125
125
  puts
126
126
 
127
127
  slow_suites.each do |slow_suite|
128
- puts "%.6fs %s" % [slow_suite[1], slow_suite[0]]
128
+ puts "%.6fs %s" % [slow_suite[1], test_class(slow_suite[0])]
129
129
  end
130
130
  end
131
131
 
@@ -201,12 +201,12 @@ module Minitest
201
201
 
202
202
  if test.skipped?
203
203
  if @detailed_skip
204
- "Skipped:\n#{test.class}##{test.name} [#{location(e)}]:\n#{e.message}"
204
+ "Skipped:\n#{test_class(test)}##{test.name} [#{location(e)}]:\n#{e.message}"
205
205
  end
206
206
  elsif test.error?
207
- "Error:\n#{test.class}##{test.name}:\n#{e.message}"
207
+ "Error:\n#{test_class(test)}##{test.name}:\n#{e.message}"
208
208
  else
209
- "Failure:\n#{test.class}##{test.name} [#{test.failure.location}]\n#{e.class}: #{e.message}"
209
+ "Failure:\n#{test_class(test)}##{test.name} [#{test.failure.location}]\n#{e.class}: #{e.message}"
210
210
  end
211
211
  end
212
212
 
@@ -92,7 +92,7 @@ module Minitest
92
92
  erb_str = File.read(@erb_template)
93
93
  renderer = ERB.new(erb_str)
94
94
 
95
- tests_by_suites = tests.group_by(&:class) # taken from the JUnit reporter
95
+ tests_by_suites = tests.group_by { |test| test_class(test) } # taken from the JUnit reporter
96
96
 
97
97
  suites = tests_by_suites.map do |suite, tests|
98
98
  suite_summary = summarize_suite(suite, tests)
@@ -26,7 +26,9 @@ module Minitest
26
26
  super
27
27
 
28
28
  puts "Writing XML reports to #{@reports_path}"
29
- suites = tests.group_by(&:class)
29
+ suites = tests.group_by { |test|
30
+ test_class(test)
31
+ }
30
32
 
31
33
  if @single_file
32
34
  xml = Builder::XmlMarkup.new(:indent => 2)
@@ -44,16 +46,24 @@ module Minitest
44
46
  xml.test_suites do
45
47
  parse_xml_for(xml, suite, tests)
46
48
  end
47
- File.open(filename_for(suite), "w") { |file| file << @xml.target! }
49
+ File.open(filename_for(suite), "w") { |file| file << xml.target! }
48
50
  end
49
51
  end
50
52
  end
51
53
 
52
54
  private
53
55
 
56
+ def get_source_location(result)
57
+ if result.respond_to? :klass
58
+ result.source_location
59
+ else
60
+ result.method(result.name).source_location
61
+ end
62
+ end
63
+
54
64
  def parse_xml_for(xml, suite, tests)
55
65
  suite_result = analyze_suite(tests)
56
- file_path = Pathname.new(tests.first.method(tests.first.name).source_location.first)
66
+ file_path = Pathname.new(get_source_location(tests.first).first)
57
67
  base_path = Pathname.new(@base_path)
58
68
  relative_path = file_path.relative_path_from(base_path)
59
69
 
@@ -62,7 +72,7 @@ module Minitest
62
72
  :errors => suite_result[:error_count], :tests => suite_result[:test_count],
63
73
  :assertions => suite_result[:assertion_count], :time => suite_result[:time]) do
64
74
  tests.each do |test|
65
- lineno = test.method(test.name).source_location.last
75
+ lineno = get_source_location(test).last
66
76
  xml.testcase(:name => test.name, :lineno => lineno, :classname => suite, :assertions => test.assertions,
67
77
  :time => test.time) do
68
78
  xml << xml_message_for(test) unless test.passed?
@@ -79,8 +79,8 @@ module Minitest
79
79
  end
80
80
 
81
81
  def print_test_with_time(test)
82
- puts [test.name, test.class, total_time].inspect
83
- print(" %s#%s (%.2fs)" % [test.name, test.class, total_time])
82
+ puts [test.name, test_class(test), total_time].inspect
83
+ print(" %s#%s (%.2fs)" % [test.name, test_class(test), total_time])
84
84
  end
85
85
 
86
86
  def color
@@ -1,5 +1,5 @@
1
1
  module Minitest
2
2
  module Reporters
3
- VERSION = '1.2.0.beta2'
3
+ VERSION = '1.2.0.beta3'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minitest-reporters
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0.beta2
4
+ version: 1.2.0.beta3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Kern
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-03 00:00:00.000000000 Z
11
+ date: 2018-02-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest