minitest-reporter-api 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f920167032c738a54df2ec1b8ea34bdbbe75e287
4
+ data.tar.gz: ebf796806a1671f9657eb65565830bdfb92f17b2
5
+ SHA512:
6
+ metadata.gz: 269da5e41f0f176b45136962a0197b3a503d7eaddc4de810293a55c9054e988ff5ddcbc8890f475100e66206172b3c4eeb6109b6a9e72d3248e1a35cba2b6ae4
7
+ data.tar.gz: 2484c1db95ec8d5d4e43bf50717eafe420fa045da5d790c5a724cd89f95c0945cd0b795a4e77c8b24d98cecb5d837a4e46294e262d7d09e7b056f6fc251168b8
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2013 Rubyworks
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
22
+
@@ -0,0 +1,11 @@
1
+ # Minitest Reporter API
2
+
3
+ Just a simple little augment to Minitest to allow reporters to
4
+ be specificed via code in test helper scripts.
5
+
6
+ Minitest.reporter = MyReporter.new
7
+
8
+ ## Copyrights
9
+
10
+ (c) 2013
11
+
@@ -0,0 +1,6 @@
1
+
2
+ default :test
3
+
4
+ desc "Run tests."
5
+ task :test do
6
+ end
@@ -0,0 +1,67 @@
1
+ module Minitest
2
+
3
+ ##
4
+ # Modify Minitest's run method to check for code configured reporters.
5
+ # This allows reporters to be configured in test helper scripts. e.g.
6
+ #
7
+ # Minitest.reporter = MyReporter.new
8
+ #
9
+ # If just the class is given, it will work as well.
10
+ #
11
+ # Minitest.reporter = MyReporter
12
+ #
13
+ # More than one reporter can be used by setting reporter to an array.
14
+ #
15
+ # Minitest.reporter = [Minitest::SummaryReporter, MyReporter.new]
16
+ #
17
+ # This definition is identical to Minitest's with the exception of the
18
+ # `if self.reporter` condition.
19
+
20
+ def self.run args = []
21
+ self.load_plugins
22
+
23
+ options = process_args args
24
+
25
+ if self.reporter
26
+ reporter = setup_reporters(self.reporter, options)
27
+ else
28
+ reporter = CompositeReporter.new
29
+ reporter << SummaryReporter.new(options[:io], options)
30
+ reporter << ProgressReporter.new(options[:io], options)
31
+ end
32
+
33
+ self.reporter = reporter # this makes it available to plugins
34
+ self.init_plugins options
35
+ self.reporter = nil # runnables shouldn't depend on the reporter, ever
36
+
37
+ reporter.start
38
+ __run reporter, options
39
+ self.parallel_executor.shutdown
40
+ reporter.report
41
+
42
+ reporter.passed?
43
+ end
44
+
45
+ ##
46
+ # Initialize reporters, if need be, and add to `reporter` property.
47
+
48
+ def self.setup_reporters(reporters, options)
49
+ reporter = CompositeReporter.new
50
+ [reporters].flatten.each do |rpt|
51
+ reporter << (
52
+ case rpt
53
+ when Class
54
+ case rpt.method(:new).arity
55
+ when 0 then rpt.new
56
+ when 1, -1 then rpt.new(options)
57
+ else rpt.new(options[:io], options)
58
+ end
59
+ else
60
+ rpt
61
+ end
62
+ )
63
+ end
64
+ return reporter
65
+ end
66
+
67
+ end
metadata ADDED
@@ -0,0 +1,78 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: minitest-reporter-api
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - trans
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-11-16 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: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: Minitest API for specifying reporters in helper scripts.
42
+ email:
43
+ - transfire@gmail.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files:
47
+ - LICENSE.txt
48
+ files:
49
+ - README.md
50
+ - Rakefile
51
+ - LICENSE.txt
52
+ - lib/minitest/reporter_api.rb
53
+ homepage: http://github.com/rubyworks/minitest-reporter
54
+ licenses: []
55
+ metadata: {}
56
+ post_install_message:
57
+ rdoc_options:
58
+ - --main
59
+ - README.md
60
+ require_paths:
61
+ - lib
62
+ required_ruby_version: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - '>='
65
+ - !ruby/object:Gem::Version
66
+ version: '0'
67
+ required_rubygems_version: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - '>='
70
+ - !ruby/object:Gem::Version
71
+ version: '0'
72
+ requirements: []
73
+ rubyforge_project: '{minitest-reporter'
74
+ rubygems_version: 2.0.3
75
+ signing_key:
76
+ specification_version: 4
77
+ summary: Minitest API for specifying reporters in helper scripts.
78
+ test_files: []