minitest 5.0.2 → 5.0.3

Sign up to get free protection for your applications and to get access to all the features.
data.tar.gz.sig CHANGED
Binary file
data/History.txt CHANGED
@@ -1,3 +1,12 @@
1
+ === 5.0.3 / 2013-05-29
2
+
3
+ * 4 minor enhancements:
4
+
5
+ * Added Runnable.with_info_handler and Runnable.on_signal.
6
+ * Moved io.sync restore to Reporter#run_and_report.
7
+ * Refactored inner loop of Reporter#report to #to_s. Callable for status updates.
8
+ * Restored MT4's mid-run report (^t). (tenderlove).
9
+
1
10
  === 5.0.2 / 2013-05-20
2
11
 
3
12
  * 3 bug fixes:
data/lib/minitest.rb CHANGED
@@ -4,7 +4,7 @@ require "optparse"
4
4
  # :include: README.txt
5
5
 
6
6
  module Minitest
7
- VERSION = "5.0.2" # :nodoc:
7
+ VERSION = "5.0.3" # :nodoc:
8
8
 
9
9
  @@installed_at_exit ||= false
10
10
  @@after_run = []
@@ -260,11 +260,39 @@ module Minitest
260
260
  filter === m || filter === "#{self}##{m}"
261
261
  }
262
262
 
263
- filtered_methods.each do |method_name|
264
- result = self.new(method_name).run
265
- raise "#{self}#run _must_ return self" unless self === result
266
- reporter.record result
263
+ with_info_handler reporter do
264
+ filtered_methods.each do |method_name|
265
+ result = self.new(method_name).run
266
+ raise "#{self}#run _must_ return self" unless self === result
267
+ reporter.record result
268
+ end
269
+ end
270
+ end
271
+
272
+ def self.with_info_handler reporter, &block # :nodoc:
273
+ handler = lambda do
274
+ unless reporter.passed? then
275
+ warn "Current results:"
276
+ warn ""
277
+ warn reporter.reporters.first
278
+ warn ""
279
+ end
267
280
  end
281
+
282
+ on_signal "INFO", handler, &block
283
+ end
284
+
285
+ def self.on_signal name, action # :nodoc:
286
+ supported = Signal.list[name]
287
+
288
+ old_trap = trap name do
289
+ old_trap.call if old_trap.respond_to? :call
290
+ action.call
291
+ end if supported
292
+
293
+ yield
294
+ ensure
295
+ trap name, old_trap if supported
268
296
  end
269
297
 
270
298
  ##
@@ -282,11 +310,11 @@ module Minitest
282
310
  @@runnables
283
311
  end
284
312
 
285
- def marshal_dump
313
+ def marshal_dump # :nodoc:
286
314
  [self.name, self.failures, self.assertions]
287
315
  end
288
316
 
289
- def marshal_load ary
317
+ def marshal_load ary # :nodoc:
290
318
  self.name, self.failures, self.assertions = ary
291
319
  end
292
320
 
@@ -395,6 +423,7 @@ module Minitest
395
423
 
396
424
  yield
397
425
 
426
+ io.sync = self.old_sync if self.sync
398
427
  report
399
428
  end
400
429
 
@@ -422,7 +451,7 @@ module Minitest
422
451
  self.assertions += result.assertions
423
452
 
424
453
  io.print "%s#%s = %.2f s = " % [result.class, result.name, result.time] if
425
- options[:verbose]
454
+ options[:verbose]
426
455
  io.print result.result_code
427
456
  io.puts if options[:verbose]
428
457
 
@@ -449,17 +478,18 @@ module Minitest
449
478
  format = "%d runs, %d assertions, %d failures, %d errors, %d skips"
450
479
  summary = format % [count, self.assertions, f, e, s]
451
480
 
452
- filtered_results = results.dup
453
- filtered_results.reject!(&:skipped?) unless options[:verbose]
454
-
455
- filtered_results.each_with_index do |result, i|
456
- io.puts "\n%3d) %s" % [i+1, result]
457
- end
458
-
481
+ io.print self
459
482
  io.puts
460
483
  io.puts summary
484
+ end
461
485
 
462
- io.sync = self.old_sync if self.sync
486
+ def to_s # :nodoc:
487
+ filtered_results = results.dup
488
+ filtered_results.reject!(&:skipped?) unless options[:verbose]
489
+
490
+ filtered_results.each_with_index.map do |result, i|
491
+ "\n%3d) %s" % [i+1, result]
492
+ end.join "\n"
463
493
  end
464
494
  end
465
495
 
data/lib/minitest/test.rb CHANGED
@@ -87,11 +87,11 @@ module Minitest
87
87
 
88
88
  attr_accessor :time
89
89
 
90
- def marshal_dump
90
+ def marshal_dump # :nodoc:
91
91
  super << self.time
92
92
  end
93
93
 
94
- def marshal_load ary
94
+ def marshal_load ary # :nodoc:
95
95
  self.time = ary.pop
96
96
  super
97
97
  end
@@ -268,19 +268,14 @@ module Minitest
268
268
  }.join "\n"
269
269
  end
270
270
 
271
- def with_info_handler # :nodoc:
272
- supports_info_signal = Signal.list["INFO"]
273
-
271
+ def with_info_handler &block # :nodoc:
274
272
  t0 = Time.now
275
273
 
276
- trap "INFO" do
277
- warn ""
278
- warn "Current: %s#%s %.2fs" % [self.class, self.name, Time.now - t0]
279
- end if supports_info_signal
274
+ handler = lambda do
275
+ warn "\nCurrent: %s#%s %.2fs" % [self.class, self.name, Time.now - t0]
276
+ end
280
277
 
281
- yield
282
- ensure
283
- trap "INFO", "DEFAULT" if supports_info_signal
278
+ self.class.on_signal "INFO", handler, &block
284
279
  end
285
280
 
286
281
  include LifecycleHooks
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minitest
3
3
  version: !ruby/object:Gem::Version
4
- hash: 51
4
+ hash: 49
5
5
  prerelease:
6
6
  segments:
7
7
  - 5
8
8
  - 0
9
- - 2
10
- version: 5.0.2
9
+ - 3
10
+ version: 5.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ryan Davis
@@ -36,7 +36,7 @@ cert_chain:
36
36
  FBHgymkyj/AOSqKRIpXPhjC6
37
37
  -----END CERTIFICATE-----
38
38
 
39
- date: 2013-05-20 00:00:00 Z
39
+ date: 2013-05-30 00:00:00 Z
40
40
  dependencies:
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rdoc
metadata.gz.sig CHANGED
Binary file