minitap 0.3.5 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (9) hide show
  1. data/.index +8 -11
  2. data/.yardopts +3 -2
  3. data/HISTORY.md +15 -0
  4. data/LICENSE.txt +5 -5
  5. data/NOTICE.md +53 -56
  6. data/README.md +7 -2
  7. data/lib/minitap.rb +196 -109
  8. metadata +3 -20
  9. data/.ruby +0 -0
data/.index CHANGED
@@ -1,6 +1,6 @@
1
1
  ---
2
- type: ruby
3
2
  revision: 2013
3
+ type: ruby
4
4
  sources:
5
5
  - var
6
6
  authors:
@@ -14,11 +14,7 @@ requirements:
14
14
  - groups:
15
15
  - build
16
16
  development: true
17
- name: detroit
18
- - groups:
19
- - build
20
- development: true
21
- name: reap
17
+ name: ergo
22
18
  - groups:
23
19
  - test
24
20
  development: true
@@ -50,17 +46,18 @@ repositories:
50
46
  scm: git
51
47
  uri: git://github.com/rubyworks/minitap.git
52
48
  categories: []
53
- paths:
54
- load:
55
- - lib
56
49
  copyrights:
57
50
  - holder: Rubyworks
58
51
  year: '2011'
59
52
  license: BSD-2-Clause
53
+ customs: []
54
+ paths:
55
+ lib:
56
+ - lib
60
57
  summary: TAP-Y/J reporters for MiniTest
61
58
  title: MiniTap
62
- version: 0.3.5
59
+ version: 0.4.0
63
60
  name: minitap
64
61
  description: MiniTap provides a MiniTest TAP-Y/J report format suitable for use with
65
62
  TAPOUT.
66
- date: '2013-01-17'
63
+ date: '2013-03-17'
data/.yardopts CHANGED
@@ -1,8 +1,9 @@
1
1
  --title "MiniTAP"
2
- --readme README.rdoc
2
+ --readme README.md
3
3
  --protected
4
4
  --private
5
5
  lib
6
6
  -
7
- [A-Z]*.*
7
+ *.md
8
+ *.txt
8
9
 
data/HISTORY.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # RELEASE HISTORY
2
2
 
3
+ ## 0.4.0 | 2013-03-17
4
+
5
+ MiniTap v0.4.0 is a heavy refactorization of the code based on
6
+ Alexander Kern's latest MiniTest-Reporters code. (Thank you
7
+ Mr. Kern! You made dealing with sorry Minitest code at least
8
+ tolerable.) This release also owes gratitiude to Kevin Swope
9
+ who's bug report about running on MiniTap with Rails led to
10
+ the whole shebang.
11
+
12
+ Changes:
13
+
14
+ * Refactored runner to "catch-up" with the ever changing
15
+ crap that is MiniTest's code.
16
+
17
+
3
18
  ## 0.3.5 | 2013-01-17
4
19
 
5
20
  This release adds a #record method to the TestRunner to accomodate
data/LICENSE.txt CHANGED
@@ -3,12 +3,12 @@ BSD-2-Clause License
3
3
  Redistribution and use in source and binary forms, with or without
4
4
  modification, are permitted provided that the following conditions are met:
5
5
 
6
- 1. Redistributions of source code must retain the above copyright notice,
7
- this list of conditions and the following disclaimer.
6
+ 1. Redistributions of source code must retain the above copyright notice,
7
+ this list of conditions and the following disclaimer.
8
8
 
9
- 2. Redistributions in binary form must reproduce the above copyright
10
- notice, this list of conditions and the following disclaimer in the
11
- documentation and/or other materials provided with the distribution.
9
+ 2. Redistributions in binary form must reproduce the above copyright
10
+ notice, this list of conditions and the following disclaimer in the
11
+ documentation and/or other materials provided with the distribution.
12
12
 
13
13
  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
14
14
  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
data/NOTICE.md CHANGED
@@ -1,59 +1,56 @@
1
1
  # COPYRIGHT NOTICES
2
2
 
3
- ## MiniTap
4
-
5
- * Copyright: (c) 2011 Rubyworks
6
- * License: BSD-2-Clause
7
- * Website: http://rubyworks.github.com/tapout
8
-
9
- Copyright 2011 Rubyworks. All rights reserved.
10
-
11
- Redistribution and use in source and binary forms, with or without
12
- modification, are permitted provided that the following conditions are met:
13
-
14
- 1. Redistributions of source code must retain the above copyright notice,
15
- this list of conditions and the following disclaimer.
16
-
17
- 2. Redistributions in binary form must reproduce the above copyright
18
- notice, this list of conditions and the following disclaimer in the
19
- documentation and/or other materials provided with the distribution.
20
-
21
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
22
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
23
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24
- COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25
- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26
- NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
28
- OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
-
32
-
33
- ## MiniTest Reporter
34
-
35
- * Copyright: (c) 2011 Alexander Kern
36
- * License: MIT
37
- * Website: https://github.com/CapnKernul/minitest-reporters
38
-
39
- Copyright (c) 2011 Alexander Kern
40
-
41
- Permission is hereby granted, free of charge, to any person obtaining
42
- a copy of this software and associated documentation files (the
43
- "Software"), to deal in the Software without restriction, including
44
- without limitation the rights to use, copy, modify, merge, publish,
45
- distribute, sublicense, and/or sell copies of the Software, and to
46
- permit persons to whom the Software is furnished to do so, subject to
47
- the following conditions:
48
-
49
- The above copyright notice and this permission notice shall be
50
- included in all copies or substantial portions of the Software.
51
-
52
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
53
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
54
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
55
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
56
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
57
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
58
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
3
+ MiniTap (http://rubyworks.github.com/tapout)
4
+
5
+ Copyright (c) 2011 Rubyworks
6
+
7
+ BSD-2-Clause License
8
+
9
+ Redistribution and use in source and binary forms, with or without
10
+ modification, are permitted provided that the following conditions are met:
11
+
12
+ 1. Redistributions of source code must retain the above copyright notice,
13
+ this list of conditions and the following disclaimer.
14
+
15
+ 2. Redistributions in binary form must reproduce the above copyright
16
+ notice, this list of conditions and the following disclaimer in the
17
+ documentation and/or other materials provided with the distribution.
18
+
19
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
20
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
21
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22
+ COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
23
+ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24
+ NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
26
+ OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
28
+ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+
30
+ --------------------------------------------------------------------------------
31
+
32
+ Minitest Reporters (https://github.com/CapnKernul/minitest-reporters)
33
+
34
+ Copyright (c) 2011 Alexander Kern
35
+
36
+ MIT License
37
+
38
+ Permission is hereby granted, free of charge, to any person obtaining
39
+ a copy of this software and associated documentation files (the
40
+ "Software"), to deal in the Software without restriction, including
41
+ without limitation the rights to use, copy, modify, merge, publish,
42
+ distribute, sublicense, and/or sell copies of the Software, and to
43
+ permit persons to whom the Software is furnished to do so, subject to
44
+ the following conditions:
45
+
46
+ The above copyright notice and this permission notice shall be
47
+ included in all copies or substantial portions of the Software.
48
+
49
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
50
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
51
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
52
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
53
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
54
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
55
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
59
56
 
data/README.md CHANGED
@@ -1,11 +1,16 @@
1
+ # MiniTap
2
+
1
3
  [Website](http://rubyworks.github.com/minitap) |
2
4
  [Documentation](http://rubydoc.info/gems/minitap/frames) |
3
5
  [Report Issue](http://github.com/rubyworks/minitap/issues) |
4
6
  [Source Code](http://github.com/rubyworks/minitap)
5
- ( [![Build Status](https://travis-ci.org/rubyworks/minitap.png)](https://travis-ci.org/rubyworks/minitap) )
6
7
 
8
+ [![Build Status](https://travis-ci.org/rubyworks/minitap.png)](https://travis-ci.org/rubyworks/minitap)
9
+ [![Gem Version](https://badge.fury.io/rb/minitap.png)](http://badge.fury.io/rb/minitap)    
10
+ [![Flattr Me](http://api.flattr.com/button/flattr-badge-large.png)](http://flattr.com/thing/324911/Rubyworks-Ruby-Development-Fund)
7
11
 
8
- # MiniTap
12
+
13
+ ## About
9
14
 
10
15
  The MiniTap project provides a TAP-Y and TAP-J output reporters for
11
16
  the MiniTest test framework --the test framework that comes standard
data/lib/minitap.rb CHANGED
@@ -1,5 +1,10 @@
1
1
  # MiniTest adaptor for tapout.
2
2
 
3
+ begin
4
+ gem 'minitest'
5
+ rescue
6
+ end
7
+
3
8
  require 'minitest/unit'
4
9
  require 'minitap/ignore_callers'
5
10
  require 'stringio'
@@ -11,15 +16,11 @@ require 'stringio'
11
16
 
12
17
  module MiniTest
13
18
 
19
+ ##
14
20
  # Base class for TapY and TapJ runners.
15
21
  #
16
- # This is a heavily refactored version of the built-in MiniTest runner. It's
17
- # about the same speed, from what I can tell, but is significantly easier to
18
- # extend.
19
- #
20
- # Based upon Ryan Davis of Seattle.rb's MiniTest (MIT License).
21
- #
22
- # @see https://github.com/seattlerb/minitest MiniTest
22
+ # Based upon Alexander Kern's MiniTest-Reporters (MIT License).
23
+ # @see https://github.com/CapnKernul/minitest-reporters
23
24
  #
24
25
  class MiniTap < ::MiniTest::Unit
25
26
 
@@ -29,94 +30,103 @@ module MiniTest
29
30
  # Backtrace patterns to be omitted.
30
31
  IGNORE_CALLERS = ::RUBY_IGNORE_CALLERS
31
32
 
32
- #
33
- attr_accessor :suite_start_time, :test_start_time, :reporters
34
-
33
+ attr_reader :test_results
34
+
35
+ attr_accessor :suites_start_time
36
+ attr_accessor :suite_start_time
37
+ attr_accessor :test_start_time
38
+
35
39
  # Initialize new MiniTap MiniTest runner.
36
40
  def initialize
37
- self.report = {}
38
- self.errors = 0
39
- self.failures = 0
40
- self.skips = 0
41
- self.test_count = 0
42
- self.assertion_count = 0
43
- self.verbose = false
44
- self.reporters = []
41
+ super
42
+
43
+ @_stdout = ''
44
+ @_stderr = ''
45
45
 
46
+ @test_results = {}
47
+ #self.assertion_count = 0
46
48
  @_source_cache = {}
47
49
  end
48
50
 
49
- # Top level driver, controls all output and filtering.
50
- def _run args = []
51
- self.options = process_args(args)
51
+ def _run_suites(suites, type)
52
+ #output.puts "# Run options: #{@help}"
52
53
 
53
- self.class.plugins.each do |plugin|
54
- send plugin
55
- break unless report.empty?
54
+ @suites_start_time = Time.now
55
+ count_tests!(suites, type)
56
+ trigger_callback(:before_suites, suites, type)
57
+ super(suites, type)
58
+ ensure
59
+ trigger_callback(:after_suites, suites, type)
60
+ end
61
+
62
+ def _run_suite(suite, type)
63
+ # The only reason this is here is b/c MiniTest wil try to run
64
+ # base classes like `MiniTest::Spec`. So to prevent that,
65
+ # if there are no tests to run, we don't bother to process
66
+ # the "suite" at all.
67
+ @_suite_tests = suite.send("#{type}_methods")
68
+ return [0,0] if @_suite_tests.empty?
69
+
70
+ begin
71
+ @suite_start_time = Time.now
72
+ trigger_callback(:before_suite, suite)
73
+
74
+ super_result = nil
75
+ #@_stdout, @_stderr = capture_io do
76
+ super_result = super(suite, type)
77
+ #end
78
+ super_result
79
+ ensure
80
+ trigger_callback(:after_suite, suite)
56
81
  end
57
-
58
- return failures + errors if @test_count > 0 # or return nil...
59
- rescue Interrupt
60
- abort 'Interrupted'
61
82
  end
62
83
 
63
- #
64
- def _run_anything(type)
65
- self.start_time = Time.now
66
-
67
- suites = suites_of_type(type)
68
- tests = suites.inject({}) do |acc, suite|
69
- acc[suite] = filtered_tests(suite, type)
70
- acc
71
- end
72
-
73
- self.test_count = tests.inject(0) { |acc, suite| acc + suite[1].length }
74
-
75
- if test_count > 0
76
- trigger(:before_suites, suites, type)
77
-
78
- fix_sync do
79
- suites.each { |suite| _run_suite(suite, tests[suite]) }
80
- end
81
-
82
- trigger(:after_suites, suites, type)
83
- end
84
+ def before_test(suite, test)
85
+ @test_start_time = Time.now
86
+ trigger_callback(:before_test, suite, test)
84
87
  end
85
-
86
- def _run_suite(suite, tests)
87
- unless tests.empty?
88
- begin
89
- self.suite_start_time = Time.now
90
-
91
- trigger(:before_suite, suite)
92
- suite.startup if suite.respond_to?(:startup)
93
-
94
- tests.each { |test| _run_test(suite, test) }
95
- ensure
96
- suite.shutdown if suite.respond_to?(:shutdown)
97
- trigger(:after_suite, suite)
98
- end
99
- end
88
+
89
+ def record(suite, test, assertions, time, exception)
90
+ record = TestRecord.new(suite, test.to_sym, assertions, time, exception)
91
+
92
+ #if exception #&& ENV['minitap_debug']
93
+ # STDERR.puts exception
94
+ # STDERR.puts exception.backtrace.join("\n")
95
+ #end
96
+
97
+ @test_results[suite] ||= {}
98
+ @test_results[suite][test.to_sym] = record
99
+ #@test_recorder.record(runner)
100
+
101
+ # MiniTest < 4.1.0 sends #record after all teardown hooks, so explicitly
102
+ # call #after_test here after recording.
103
+ after_test(suite, test) if Unit::VERSION <= "4.1.0"
100
104
  end
101
-
102
- #
103
- def _run_test(suite, test)
104
- self.test_start_time = Time.now
105
105
 
106
- trigger(:before_test, suite, test)
107
-
108
- test_runner = TestRunner.new(suite, test)
109
- test_runner.run
110
- add_test_result(suite, test, test_runner)
111
-
112
- trigger(test_runner.result, suite, test, test_runner)
106
+ def after_test(suite, test)
107
+ #runners = @test_recorder[suite, test.to_sym]
108
+ #records = @test_results[suite][test.to_sym]
109
+ record = @test_results[suite][test.to_sym]
110
+
111
+ #records.each do |record|
112
+ # trigger_callback(record.result, suite, test.to_sym, record)
113
+ #end
114
+
115
+ trigger_callback(record.result, suite, test.to_sym, record)
116
+
117
+ #trigger_callback(:after_test, suite, test.to_sym)
113
118
  end
114
-
115
- #
116
- def trigger(callback, *args)
119
+
120
+ # Trigger the tapout callback.
121
+ def trigger_callback(callback, *args)
117
122
  send("tapout_#{callback}", *args)
118
123
  end
119
124
 
125
+ # Stub out the three IO methods used by the built-in reporter.
126
+ def puts(*args); end
127
+ def print(*args); end
128
+ def status(io = output); end
129
+
120
130
  private
121
131
 
122
132
  #
@@ -125,12 +135,13 @@ module MiniTest
125
135
  filter = Regexp.new($1) if filter =~ /\/(.*)\//
126
136
  suite.send("#{type}_methods").grep(filter)
127
137
  end
128
-
138
+
129
139
  #
130
- def suites_of_type(type)
131
- TestCase.send("#{type}_suites")
132
- end
133
-
140
+ #def suites_of_type(type)
141
+ # TestCase.send("#{type}_suites")
142
+ #end
143
+
144
+ =begin
134
145
  #
135
146
  def add_test_result(suite, test, test_runner)
136
147
  self.report[suite] ||= {}
@@ -144,20 +155,22 @@ module MiniTest
144
155
  when :error then self.errors += 1
145
156
  end
146
157
  end
158
+ =end
147
159
 
148
- #
149
- def fix_sync
150
- sync = output.respond_to?(:'sync=') # stupid emacs
151
- old_sync, output.sync = output.sync, true if sync
152
- yield
153
- output.sync = old_sync if sync
160
+ def count_tests!(suites, type)
161
+ filter = options[:filter] || '/./'
162
+ filter = Regexp.new $1 if filter =~ /\/(.*)\//
163
+
164
+ @test_count = suites.inject(0) do |acc, suite|
165
+ acc + suite.send("#{type}_methods").grep(filter).length
166
+ end
154
167
  end
155
168
 
156
169
  #
157
170
  def tapout_before_suites(suites, type)
158
171
  doc = {
159
172
  'type' => 'suite',
160
- 'start' => self.start_time.strftime('%Y-%m-%d %H:%M:%S'),
173
+ 'start' => self.suites_start_time.strftime('%Y-%m-%d %H:%M:%S'),
161
174
  'count' => self.test_count,
162
175
  'seed' => self.options[:seed],
163
176
  'rev' => REVISION
@@ -169,7 +182,7 @@ module MiniTest
169
182
  def tapout_after_suites(suites, type)
170
183
  doc = {
171
184
  'type' => 'final',
172
- 'time' => Time.now - self.test_start_time,
185
+ 'time' => Time.now - self.suites_start_time,
173
186
  'counts' => {
174
187
  'total' => self.test_count,
175
188
  'pass' => self.test_count - self.failures - self.errors - self.skips,
@@ -201,6 +214,10 @@ module MiniTest
201
214
  def tapout_before_test(suite, test)
202
215
  end
203
216
 
217
+ #
218
+ def tapout_after_test(suite, test)
219
+ end
220
+
204
221
  #
205
222
  def tapout_pass(suite, test, test_runner)
206
223
  doc = {
@@ -225,7 +242,7 @@ module MiniTest
225
242
  'time' => Time.now - self.suite_start_time
226
243
  }
227
244
 
228
- stdout, stderr = test_runner.stdout, test_runner.stderr
245
+ stdout, stderr = @_stdout, @_stderr
229
246
  doc['stdout'] = stdout unless stdout.empty?
230
247
  doc['stderr'] = stderr unless stderr.empty?
231
248
 
@@ -308,7 +325,7 @@ module MiniTest
308
325
  'time' => Time.now - self.suite_start_time
309
326
  }
310
327
 
311
- stdout, stderr = test_runner.stdout, test_runner.stderr
328
+ stdout, stderr = @_stdout, @_stderr
312
329
  doc['stdout'] = stdout unless stdout.empty?
313
330
  doc['stderr'] = stderr unless stderr.empty?
314
331
 
@@ -352,7 +369,7 @@ module MiniTest
352
369
  'time' => Time.now - self.suite_start_time
353
370
  }
354
371
 
355
- stdout, stderr = test_runner.stdout, test_runner.stderr
372
+ stdout, stderr = @_stdout, @_stderr
356
373
  doc['stdout'] = stdout unless stdout.empty?
357
374
  doc['stderr'] = stderr unless stderr.empty?
358
375
 
@@ -440,8 +457,36 @@ module MiniTest
440
457
  message.strip #.gsub(/\s*\n\s*/, "\n")
441
458
  end
442
459
 
460
+ #
461
+ def capture_io
462
+ ostdout, ostderr = $stdout, $stderr
463
+ cstdout, cstderr = StringIO.new, StringIO.new
464
+ $stdout, $stderr = cstdout, cstderr
465
+
466
+ yield
467
+
468
+ return cstdout.string.chomp("\n"), cstderr.string.chomp("\n")
469
+ ensure
470
+ $stdout = ostdout
471
+ $stderr = ostderr
472
+ end
473
+
443
474
  end
444
475
 
476
+ ##
477
+ #
478
+ class TestRecord < Struct.new(:suite, :test, :assertions, :time, :exception)
479
+ def result
480
+ case exception
481
+ when nil then :pass
482
+ when Skip then :skip
483
+ when Assertion then :failure
484
+ else :error
485
+ end
486
+ end
487
+ end
488
+
489
+ =begin
445
490
  # Runner for individual MiniTest tests.
446
491
  #
447
492
  # You *should not* create instances of this class directly. Instances of
@@ -502,34 +547,71 @@ module MiniTest
502
547
  $stderr = ostderr
503
548
  end
504
549
  end
550
+ =end
505
551
 
552
+ ##
553
+ #
554
+ module AroundTestHooks
555
+ def self.before_test(instance)
556
+ MiniTest::Unit.runner.before_test(instance.class, instance.__name__)
557
+ end
558
+
559
+ def self.after_test(instance)
560
+ # MiniTest < 4.1.0 sends #record after all teardown hooks, so don't call
561
+ # #after_test here.
562
+ if MiniTest::Unit::VERSION > "4.1.0"
563
+ MiniTest::Unit.runner.after_test(instance.class, instance.__name__)
564
+ end
565
+ end
566
+
567
+ def before_setup
568
+ AroundTestHooks.before_test(self)
569
+ super
570
+ end
571
+
572
+ def after_teardown
573
+ super
574
+ AroundTestHooks.after_test(self)
575
+ end
576
+ end
577
+
578
+ class Unit::TestCase
579
+ include AroundTestHooks
580
+ end
581
+
582
+ ##
506
583
  #
507
584
  class TapY < MiniTap
508
585
  def initialize
509
586
  require 'yaml' unless respond_to?(:to_yaml)
510
587
  super
511
588
  end
589
+
512
590
  def tapout_before_suites(suites, type)
513
- puts super(suites, type).to_yaml
591
+ wp super(suites, type).to_yaml
514
592
  end
515
593
  def tapout_before_suite(suite)
516
- puts super(suite).to_yaml
594
+ wp super(suite).to_yaml
517
595
  end
518
596
  def tapout_pass(suite, test, test_runner)
519
- puts super(suite, test, test_runner).to_yaml
597
+ wp super(suite, test, test_runner).to_yaml
520
598
  end
521
599
  def tapout_skip(suite, test, test_runner)
522
- puts super(suite, test, test_runner).to_yaml
600
+ wp super(suite, test, test_runner).to_yaml
523
601
  end
524
602
  def tapout_failure(suite, test, test_runner)
525
- puts super(suite, test, test_runner).to_yaml
603
+ wp super(suite, test, test_runner).to_yaml
526
604
  end
527
605
  def tapout_error(suite, test, test_runner)
528
- puts super(suite, test, test_runner).to_yaml
606
+ wp super(suite, test, test_runner).to_yaml
529
607
  end
530
608
  def tapout_after_suites(suites, type)
531
- puts super(suites, type).to_yaml
532
- puts "..."
609
+ wp super(suites, type).to_yaml
610
+ wp "..."
611
+ end
612
+
613
+ def wp(str)
614
+ STDOUT.puts(str)
533
615
  end
534
616
  end
535
617
 
@@ -539,26 +621,31 @@ module MiniTest
539
621
  require 'json' unless respond_to?(:to_json)
540
622
  super
541
623
  end
624
+
542
625
  def tapout_before_suites(suites, type)
543
- puts super(suites, type).to_json
626
+ wp super(suites, type).to_json
544
627
  end
545
628
  def tapout_before_suite(suite)
546
- puts super(suite).to_json
629
+ wp super(suite).to_json
547
630
  end
548
631
  def tapout_pass(suite, test, test_runner)
549
- puts super(suite, test, test_runner).to_json
632
+ wp super(suite, test, test_runner).to_json
550
633
  end
551
634
  def tapout_skip(suite, test, test_runner)
552
- puts super(suite, test, test_runner).to_json
635
+ wp super(suite, test, test_runner).to_json
553
636
  end
554
637
  def tapout_failure(suite, test, test_runner)
555
- puts super(suite, test, test_runner).to_json
638
+ wp super(suite, test, test_runner).to_json
556
639
  end
557
640
  def tapout_error(suite, test, test_runner)
558
- puts super(suite, test, test_runner).to_json
641
+ wp super(suite, test, test_runner).to_json
559
642
  end
560
643
  def tapout_after_suites(suites, type)
561
- puts super(suites, type).to_json
644
+ wp super(suites, type).to_json
645
+ end
646
+
647
+ def wp(str)
648
+ STDOUT.puts(str)
562
649
  end
563
650
  end
564
651
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minitap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
4
+ version: 0.4.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-16 00:00:00.000000000 Z
12
+ date: 2013-03-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: tapout
@@ -44,23 +44,7 @@ dependencies:
44
44
  - !ruby/object:Gem::Version
45
45
  version: '0'
46
46
  - !ruby/object:Gem::Dependency
47
- name: detroit
48
- requirement: !ruby/object:Gem::Requirement
49
- none: false
50
- requirements:
51
- - - ! '>='
52
- - !ruby/object:Gem::Version
53
- version: '0'
54
- type: :development
55
- prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
- requirements:
59
- - - ! '>='
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- - !ruby/object:Gem::Dependency
63
- name: reap
47
+ name: ergo
64
48
  requirement: !ruby/object:Gem::Requirement
65
49
  none: false
66
50
  requirements:
@@ -121,7 +105,6 @@ extra_rdoc_files:
121
105
  - NOTICE.md
122
106
  files:
123
107
  - .index
124
- - .ruby
125
108
  - .yardopts
126
109
  - lib/minitap/ignore_callers.rb
127
110
  - lib/minitap/tapj.rb
data/.ruby DELETED
File without changes