minitest-junit 0.0.1

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: fb75f516200b3009029ae7c6244da92aefcc8894
4
+ data.tar.gz: c7a8236e16e84547ba2c09c290bf6b90e1506807
5
+ SHA512:
6
+ metadata.gz: 3cfc3cae4fd2a4e764ad14e53f7d161c990371834867a12332f57273dc0f51c838b1f24bdd305dd394ea0de92a943c7070aafe84a722c50ffe56ee6da0d9eafc
7
+ data.tar.gz: f1e8609c3fb99c055d86a3e03d2d65447ac5ca40ce423d3762404e034813734025c73fe6eeeba7575400014a643dc59ac66a8a2c7c5f5cc64d67e3b35572b370
data/.gitignore ADDED
@@ -0,0 +1,22 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ *.bundle
19
+ *.so
20
+ *.o
21
+ *.a
22
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in minitest-junit.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Allan Espinosa
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # Minitest::Junit
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'minitest-junit'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install minitest-junit
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it ( https://github.com/[my-github-username]/minitest-junit/fork )
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,9 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rubocop/rake_task'
3
+ require 'rake/testtask'
4
+
5
+ RuboCop::RakeTask.new
6
+
7
+ Rake::TestTask.new do |t|
8
+ t.test_files = FileList['test/*_test.rb']
9
+ end
@@ -0,0 +1,13 @@
1
+ require 'minitest/junit/version'
2
+
3
+ # :nodoc:
4
+ module Minitest
5
+ # :nodoc:
6
+ module Junit
7
+ # :nodoc:
8
+ class Reporter
9
+ def initialize(_io)
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,6 @@
1
+ module Minitest
2
+ # :nodoc:
3
+ module Junit
4
+ VERSION = '0.0.1'
5
+ end
6
+ end
@@ -0,0 +1,22 @@
1
+ require 'minitest/junit'
2
+
3
+ # :nodoc:
4
+ module Minitest
5
+ def self.plugin_junit_options(opts, options)
6
+ opts.on '--junit', 'Generate a junit xml report' do
7
+ options[:junit] = true
8
+ end
9
+ opts.on '--junit-filename=OUT', 'Target output filename.'\
10
+ ' Defaults to report.xml' do |out|
11
+ options[:junit_filename] = out
12
+ end
13
+ end
14
+
15
+ def self.plugin_junit_init(options)
16
+ if options[:junit]
17
+ file_klass = options[:file_klass] || File
18
+ io = file_klass.new options[:junit_filename] || 'report.xml', 'w'
19
+ reporter << Junit::Reporter.new(io) if options[:junit]
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'minitest/junit/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'minitest-junit'
8
+ spec.version = Minitest::Junit::VERSION
9
+ spec.authors = ['Allan Espinosa']
10
+ spec.email = ['allan.espinosa@outlook.com']
11
+ spec.summary = 'Junit reporter for Minitest ~> 5.0'
12
+ spec.description = 'Junit reporter for Minitest ~> 5.0'
13
+ spec.homepage = 'http://github.com/aespinosa/minitest-junit'
14
+ spec.license = 'MIT'
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(/^bin\//) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(/^(test)\//)
19
+ spec.require_paths = ['lib']
20
+
21
+ spec.add_dependency 'minitest', '~> 5.0'
22
+
23
+ spec.add_development_dependency 'bundler', '~> 1.6'
24
+ spec.add_development_dependency 'rake', '~> 10.3.2'
25
+ spec.add_development_dependency 'rubocop', '~> 0.24.1'
26
+ end
@@ -0,0 +1,76 @@
1
+ require 'minitest/autorun'
2
+ require 'minitest/mock'
3
+ require 'minitest/junit_plugin'
4
+
5
+ # :nodoc:
6
+ class PluginTest < Minitest::Test
7
+ def test_by_default_the_plugin_is_disabled
8
+ opts = OptionParser.new
9
+ options = {}
10
+
11
+ Minitest.plugin_junit_options opts, options
12
+ opts.parse('')
13
+
14
+ assert_equal({}, options)
15
+ end
16
+
17
+ def test_setting_the_commandline_activates_the_plugin
18
+ opts = OptionParser.new
19
+ options = {}
20
+ Minitest.plugin_junit_options opts, options
21
+ opts.parse('--junit')
22
+
23
+ assert_equal({ junit: true }, options)
24
+ end
25
+
26
+ def test_by_default_doesnt_include_the_repoter
27
+ options = {}
28
+ Minitest.reporter = []
29
+
30
+ Minitest.plugin_junit_init(options)
31
+
32
+ assert_equal [], Minitest.reporter
33
+ end
34
+
35
+ def test_when_enabled_adds_the_plugin_to_the_list_of_reporters
36
+ options = { junit: true }
37
+ Minitest.reporter = []
38
+
39
+ Minitest.plugin_junit_init(options)
40
+
41
+ assert_instance_of Minitest::Junit::Reporter, Minitest.reporter[0]
42
+ end
43
+
44
+ def test_output_is_dumped_to_reportxml_by_default
45
+ file_klass = Minitest::Mock.new
46
+ options = { junit: true, file_klass: file_klass }
47
+ Minitest.reporter = []
48
+
49
+ file_klass.expect(:new, true, ['report.xml', 'w'])
50
+ Minitest.plugin_junit_init(options)
51
+
52
+ file_klass.verify
53
+ end
54
+
55
+ def test_output_is_dumped_to_specified_filename
56
+ file_klass = Minitest::Mock.new
57
+ options = { junit: true, junit_filename: 'somefile.xml',
58
+ file_klass: file_klass }
59
+ Minitest.reporter = []
60
+
61
+ file_klass.expect(:new, true, ['somefile.xml', 'w'])
62
+ Minitest.plugin_junit_init(options)
63
+
64
+ file_klass.verify
65
+ end
66
+
67
+ def test_custom_filename_is_specified_by_a_flag
68
+ opts = OptionParser.new
69
+ options = {}
70
+
71
+ Minitest.plugin_junit_options opts, options
72
+ opts.parse('--junit-filename=somefile.xml')
73
+
74
+ assert_equal 'somefile.xml', options[:junit_filename]
75
+ end
76
+ end
metadata ADDED
@@ -0,0 +1,111 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: minitest-junit
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Allan Espinosa
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-07-26 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: minitest
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '5.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '5.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.6'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.6'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 10.3.2
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 10.3.2
55
+ - !ruby/object:Gem::Dependency
56
+ name: rubocop
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 0.24.1
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 0.24.1
69
+ description: Junit reporter for Minitest ~> 5.0
70
+ email:
71
+ - allan.espinosa@outlook.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".gitignore"
77
+ - Gemfile
78
+ - LICENSE.txt
79
+ - README.md
80
+ - Rakefile
81
+ - lib/minitest/junit.rb
82
+ - lib/minitest/junit/version.rb
83
+ - lib/minitest/junit_plugin.rb
84
+ - minitest-junit.gemspec
85
+ - test/junit_plugin_test.rb
86
+ homepage: http://github.com/aespinosa/minitest-junit
87
+ licenses:
88
+ - MIT
89
+ metadata: {}
90
+ post_install_message:
91
+ rdoc_options: []
92
+ require_paths:
93
+ - lib
94
+ required_ruby_version: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
99
+ required_rubygems_version: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ requirements: []
105
+ rubyforge_project:
106
+ rubygems_version: 2.2.2
107
+ signing_key:
108
+ specification_version: 4
109
+ summary: Junit reporter for Minitest ~> 5.0
110
+ test_files:
111
+ - test/junit_plugin_test.rb