minitest-reporters 1.1.0.beta1 → 1.1.0.beta2

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: 453fd9a440eec05f750685b983f9ca37a4297462
4
- data.tar.gz: f72150a110db58c7ce015395c5a17d20f7c7d4c2
3
+ metadata.gz: ca55ff39f0701a6c94aef40eae8dd25a8f6f28e0
4
+ data.tar.gz: b5ffd1347b500e2fb8d9e2d86aff29db88f3ea96
5
5
  SHA512:
6
- metadata.gz: c62c7392c5f919ca42c1c99605c3b080dc83c3864e779e88706205706a7eaec50b57852dada9bee2f8b82a03e40babccb3ec26d488bb6f88b7bc00f849ae1724
7
- data.tar.gz: 947d6aad22baf0d49c5569672dc293ba6a84a2f705164c58270656651910bfc815f19421e25e056952d8aebb9552a04edb6134d12b23a2f5302c36e8f7d5ab24
6
+ metadata.gz: da015fa007dd00d09bb199d97c4465ff4191559baed673e62034ca5737799f7395e8fc245ce0cc851ec3afc39b353a39f9da1f174060e4c653fcdbbbb110db0f
7
+ data.tar.gz: bd079d20f92b50faa8f395c09350f55d0186fb0f58e7d22755e11b51c89bb308542eb064df9cbdedd3fc76e2e7611aa67618320fef4fc6adb776232f2c60fc04
@@ -9,9 +9,10 @@ module Minitest
9
9
  # Also inspired by Marc Seeger's attempt at producing a JUnitReporter (see https://github.com/rb2k/minitest-reporters/commit/e13d95b5f884453a9c77f62bc5cba3fa1df30ef5)
10
10
  # Also inspired by minitest-ci (see https://github.com/bhenderson/minitest-ci)
11
11
  class JUnitReporter < BaseReporter
12
- def initialize(reports_dir = "test/reports", empty = true)
12
+ def initialize(reports_dir = "test/reports", empty = true, options = {})
13
13
  super({})
14
14
  @reports_path = File.absolute_path(reports_dir)
15
+ @single_file = options[:single_file]
15
16
 
16
17
  if empty
17
18
  puts "Emptying #{@reports_path}"
@@ -26,27 +27,36 @@ module Minitest
26
27
  puts "Writing XML reports to #{@reports_path}"
27
28
  suites = tests.group_by(&:class)
28
29
 
29
- suites.each do |suite, tests|
30
- suite_result = analyze_suite(tests)
31
-
32
- xml = Builder::XmlMarkup.new(:indent => 2)
33
- xml.instruct!
34
- xml.testsuite(:name => suite, :skipped => suite_result[:skip_count], :failures => suite_result[:fail_count],
35
- :errors => suite_result[:error_count], :tests => suite_result[:test_count],
36
- :assertions => suite_result[:assertion_count], :time => suite_result[:time]) do
37
- tests.each do |test|
38
- xml.testcase(:name => test.name, :classname => suite, :assertions => test.assertions,
39
- :time => test.time) do
40
- xml << xml_message_for(test) unless test.passed?
41
- end
42
- end
30
+ if @single_file
31
+ write_xml_file_for("minitest", tests.group_by(&:class).values.flatten)
32
+ else
33
+ suites.each do |suite, tests|
34
+ write_xml_file_for(suite, tests)
43
35
  end
44
- File.open(filename_for(suite), "w") { |file| file << xml.target! }
45
36
  end
37
+
46
38
  end
47
39
 
48
40
  private
49
41
 
42
+ def write_xml_file_for(suite, tests)
43
+ suite_result = analyze_suite(tests)
44
+
45
+ xml = Builder::XmlMarkup.new(:indent => 2)
46
+ xml.instruct!
47
+ xml.testsuite(:name => suite, :skipped => suite_result[:skip_count], :failures => suite_result[:fail_count],
48
+ :errors => suite_result[:error_count], :tests => suite_result[:test_count],
49
+ :assertions => suite_result[:assertion_count], :time => suite_result[:time]) do
50
+ tests.each do |test|
51
+ xml.testcase(:name => test.name, :classname => suite, :assertions => test.assertions,
52
+ :time => test.time) do
53
+ xml << xml_message_for(test) unless test.passed?
54
+ end
55
+ end
56
+ end
57
+ File.open(filename_for(suite), "w") { |file| file << xml.target! }
58
+ end
59
+
50
60
  def xml_message_for(test)
51
61
  # This is a trick lifted from ci_reporter
52
62
  xml = Builder::XmlMarkup.new(:indent => 2, :margin => 2)
@@ -1,5 +1,5 @@
1
1
  module Minitest
2
2
  module Reporters
3
- VERSION = '1.1.0.beta1'
3
+ VERSION = '1.1.0.beta2'
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.1.0.beta1
4
+ version: 1.1.0.beta2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Kern
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-17 00:00:00.000000000 Z
11
+ date: 2015-08-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest