minitest 5.25.4 → 5.27.0

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
  SHA256:
3
- metadata.gz: 7ea765a693b5e0ff21498e24a2880144f5e407283d225a6052dde11fbe6165a5
4
- data.tar.gz: 73f500c0dd7bbd0cbedcfa7c68d72da8f089f9397cd17d4a03e8f5bad0b40537
3
+ metadata.gz: f9144898bc998f49d23688386cb435165b7ba6fadf83acc47f8120992d2799c6
4
+ data.tar.gz: f90178ecc10c76e8d0cea4c2206972b3bbb899f552c53f1b22743e00d9898a02
5
5
  SHA512:
6
- metadata.gz: 1028ca9777f3dc15155dbe813565e886df7c6d1b69d3074fdae470784c4bd8f96ee49602d2ea048832a71647b84b2d42ab9dcba0c2d948b8ec1cfb40c0e304b3
7
- data.tar.gz: 05fb281d6ba736c47ade5c871472ab339ef8a7f14d68c88f9fbb7190d3f2e9c7d387f571e6d45fa9d25076b0794e6eb16cc993b79637b67e55996954e51678d8
6
+ metadata.gz: a157620a20602d17c8aaf088cc9c709401d7fd3507569fceb85d358c5519596fdb2bd71ef8b1b597942ba9ba5ef9b0af1530fb97a47fac28add36600516d2edc
7
+ data.tar.gz: 17c0fdb228c63bda818fbc4009c30c88138df74e325e087050843bef8128ea54afade9de4c0e5af6d5f734ad114d34dd97e4eed2ac4e577662144ad8c49f261e
checksums.yaml.gz.sig CHANGED
@@ -1,2 +1,4 @@
1
- A kb�㢩��)8)����H�����sF=2�/�|d��b~8x�(K�h�ԡ`�m��F�`�Bz� ��`8��W�$G4m0�-r�p�7K��8}�Ҳ�LN�!�/:k�s���p�D]��k/c97�^ �GHN‰]�j��s-��~L K�o=���C
2
- y2��=O��Y򫑣&�&�00�?�N�ե��fW1 ���-�|��d��3���R�5O�+B_��)Cڡ���Q�#E�OLF}��&�����}��
1
+
2
+ ��ި�f5e4|���8 %8V�:��]Xo���q
3
+ ��uץ6 ��#�()��u��N������<�ƅ�v
4
+ �������75��NY���x�z@�~�9�� {��e�\���E�N��jp�4�2ovX�l1��f�k�����Ru��qv O�d��%���������87y�5�4r����
data/History.rdoc CHANGED
@@ -1,3 +1,54 @@
1
+ === 5.26.2 / 2025-11-17
2
+
3
+ * 5 bug fixes:
4
+
5
+ * Bumped minimum ruby to 3.1.
6
+ * Alias Spec#name to #inspect for cleaner output in repls.
7
+ * Fix pathing for Hoe::Minitest initialization to be more generic.
8
+ * Fixed refute_in_epsilon to use min of abs values. (wtn)
9
+ * Improved options processing and usage output to be more clear.
10
+
11
+ === 5.26.1 / 2025-11-08
12
+
13
+ The Ocean Shores, Slightly Less Tipsy Edition!
14
+
15
+ * 3 bug fixes:
16
+
17
+ * Add links to API doco in README.
18
+ * Add missing require thread.
19
+ * Bumped ruby version to include 4.0 (trunk). (hsbt)
20
+ (see also 5.14.2)
21
+
22
+ === 5.26.0 / 2025-10-07
23
+
24
+ The Seattle.rb Nerd Party, Slightly Tipsy Edition!
25
+
26
+ * 2 minor enhancements:
27
+
28
+ * Added extra documentation to Minitest::TestTask options.
29
+ * Make parallelize_me! a no-op when n_threads=1.
30
+
31
+ * 9 bug fixes:
32
+
33
+ * Bypass parallel_executor entirely when n_threads=1.
34
+ * Don't require rubygems in Rakefile... it is 2025.
35
+ * Ensure that minitest exits non-zero on Interrupt. (tavianator)
36
+ * Fix Minitest.run sequence rdoc to include loop vars and read consistently.
37
+ * Fix call to parallel_executor.shutdown when it isn't defined.
38
+ * Removed some 1.8/1.9-based code from the assertions and expectations.
39
+ * Still fighting with rdoc? Yup. Still fighting with rdoc...
40
+ * Switched assert_equal's diff from Tempfile.open to Tempfile.create.
41
+ * Use Regexp.escape for BASE_RE in case pwd has special chars. (astra_1993)
42
+
43
+ === 5.25.5 / 2025-03-12
44
+
45
+ * 4 bug fixes:
46
+
47
+ * Bumped minimum ruby to 2.7.
48
+ * Fixed expectation docs for must/wont_pattern_match. (jaredcwhite)
49
+ * Reorder Minitest::Test.ancestors to allow reaching Minitest::Assertions#skipped? (Edouard-chin)
50
+ * Update the ruby and rails compatibility tables. (bquorning)
51
+
1
52
  === 5.25.4 / 2024-12-03
2
53
 
3
54
  * 1 bug fix:
data/README.rdoc CHANGED
@@ -1,11 +1,12 @@
1
1
  = minitest/{test,spec,mock,benchmark}
2
2
 
3
- home :: https://github.com/minitest/minitest
3
+ home :: https://minite.st/
4
+ code :: https://github.com/minitest/minitest
4
5
  bugs :: https://github.com/minitest/minitest/issues
5
6
  rdoc :: https://docs.seattlerb.org/minitest
6
7
  clog :: https://github.com/minitest/minitest/blob/master/History.rdoc
7
- vim :: https://github.com/sunaku/vim-ruby-minitest
8
8
  emacs:: https://github.com/arthurnn/minitest-emacs
9
+ vim :: https://github.com/vim-test/vim-test
9
10
 
10
11
  == DESCRIPTION:
11
12
 
@@ -95,7 +96,9 @@ Given that you'd like to test the following class:
95
96
 
96
97
  === Unit tests
97
98
 
98
- Define your tests as methods beginning with +test_+.
99
+ Define your tests as methods beginning with +test_+. Use
100
+ {assertions}[/minitest/Minitest/Assertions.html] to test for results
101
+ or state.
99
102
 
100
103
  require "minitest/autorun"
101
104
 
@@ -119,6 +122,9 @@ Define your tests as methods beginning with +test_+.
119
122
 
120
123
  === Specs
121
124
 
125
+ Use {expectations}[/minitest/Minitest/Expectations.html] to check
126
+ results or state. They must be wrapped in a value call (eg +_+).
127
+
122
128
  require "minitest/autorun"
123
129
 
124
130
  describe Meme do
@@ -146,7 +152,7 @@ For matchers support check out:
146
152
 
147
153
  === Benchmarks
148
154
 
149
- Add benchmarks to your tests.
155
+ Add {benchmarks}[/minitest/Minitest/Benchmark.html] to your tests.
150
156
 
151
157
  # optionally run benchmarks, good for CI-only work!
152
158
  require "minitest/benchmark" if ENV["BENCH"]
@@ -412,33 +418,37 @@ supporting versions of ruby that are long past EOL. Hopefully I'll be
412
418
  able to support only current versions of ruby sometime in the near
413
419
  future.
414
420
 
415
- (As of 2024-05-10)
421
+ NOTICE: At this point, I will only locally test/dev against the
422
+ currently 3 supported (non-EOL) versions of ruby. I cannot and will
423
+ not maintain that many builds.
424
+
425
+ (As of 2025-02-03)
416
426
 
417
427
  Current versions of rails: (https://endoflife.date/rails)
418
428
 
419
429
  | rails | min ruby | minitest | status | EOL Date |
420
430
  |-------+----------+----------+----------+------------|
421
- | 7.1 | >= 2.7 | >= 5.1 | Current | 2026-06-01?|
422
- | 7.0 | >= 2.7 | >= 5.1 | Maint | 2025-06-01?|
423
- | 6.1 | >= 2.5 | >= 5.1 | Security | 2024-06-01?|
424
- | 6.0 | >= 2.5 | >= 5.1 | EOL | 2023-06-01 |
425
- | 5.2 | >= 2.2.2 | ~> 5.1 | EOL | 2022-06-01 |
431
+ | 8.1 | >= 3.2 | >= 5.1 | Current | 2027-10-07 |
432
+ | 8.0 | >= 3.2 | >= 5.1 | Current | 2026-11-07 |
433
+ | 7.2 | >= 3.1 | >= 5.1 | Security | 2026-08-09 |
434
+ | 7.1 | >= 2.7 | >= 5.1 | EOL | 2025-10-01 |
426
435
 
427
436
  If you want to look at the requirements for a specific version, run:
428
437
 
429
- gem spec -r --ruby rails -v 7.0.0
438
+ gem spec -r --ruby rails -v 8.0.0
430
439
 
431
440
  Current versions of ruby: (https://endoflife.date/ruby)
432
441
 
433
442
  | ruby | Status | EOL Date |
434
443
  |------+---------+------------|
435
- | 3.3 | Current | 2027-03-31 |
436
- | 3.2 | Maint | 2026-03-31 |
437
- | 3.1 | Security| 2025-03-31 |
444
+ | 3.4 | Current | 2028-03-31 |
445
+ | 3.3 | Maint | 2027-03-31 |
446
+ | 3.2 | Security| 2026-03-31 |
447
+ | 3.1 | EOL | 2025-03-31 |
438
448
  | 3.0 | EOL | 2024-03-31 |
439
449
  | 2.7 | EOL | 2023-03-31 |
440
450
  | 2.6 | EOL | 2022-03-31 |
441
- | 2.5 | EOL | 2021-03-31 | DO YOU SEE WHAT I'M STUCK WITH???
451
+ | 2.5 | EOL | 2021-03-31 |
442
452
 
443
453
  === How to test SimpleDelegates?
444
454
 
data/Rakefile CHANGED
@@ -1,6 +1,5 @@
1
1
  # -*- ruby -*-
2
2
 
3
- require "rubygems"
4
3
  require "hoe"
5
4
  $:.unshift "lib" # to pick up lib/minitest/test_task.rb when minitest not installed
6
5
 
@@ -12,7 +11,24 @@ Hoe.spec "minitest" do
12
11
 
13
12
  license "MIT"
14
13
 
15
- require_ruby_version [">= 2.6", "< 4.0"]
14
+ require_ruby_version ">= 3.1"
15
+
16
+ self.post_install_message = <<~EOM
17
+ NOTE: minitest 5 will be the last in the minitest family to support
18
+ ruby 1.8 to 2.7. If you need to keep using these versions,
19
+ you need to pin your dependency to minitest with something
20
+ like "~> 5.0". See History.rdoc to locate compatible
21
+ versions.
22
+
23
+ Further, minitest 6 will be dropping the following:
24
+
25
+ + MiniTest (it's been Minitest for >10 years)
26
+ + MiniTest::Unit
27
+ + MiniTest::Unit::TestCase
28
+ + assert_send (unless you argue for it well)
29
+ + assert_equal nil, obj
30
+ + mocks and stubs: moving minitest/mock.rb to its own gem
31
+ EOM
16
32
  end
17
33
 
18
34
  desc "Find missing expectations"
data/design_rationale.rb CHANGED
@@ -2,25 +2,27 @@
2
2
  ###############################################################################
3
3
  describe Thingy do # class TestThingy < Minitest::Test
4
4
  before do # def setup
5
- do_some_setup # super
6
- end # do_some_setup
7
- # end
8
- it "should do the first thing" do #
9
- 1.must_equal 1 # def test_first_thing
10
- end # assert_equal 1, 1
11
- # end
12
- describe SubThingy do # end
13
- before do #
14
- do_more_setup # class TestSubThingy < TestThingy
15
- end # def setup
16
5
  # super
17
- it "should do the second thing" do # do_more_setup
18
- 2.must_equal 2 # end
19
- end #
20
- end # def test_second_thing
21
- end # assert_equal 2, 2
22
- # end
6
+ do_some_setup # do_some_setup
7
+ end # end
8
+ #
9
+ it "should do the first thing" do # def test_first_thing
10
+ _(1).must_equal 1 # assert_equal 1, 1
11
+ end # end
23
12
  # end
13
+ #
14
+ describe SubThingy do # class TestSubThingy < TestThingy
15
+ before do # def setup
16
+ # super
17
+ do_more_setup # do_more_setup
18
+ end # end
19
+ #
20
+ it "should do the second thing" do # def test_second_thing
21
+ _(2).must_equal 2 # assert_equal 2, 2
22
+ end # end
23
+ end # end
24
+ end #
25
+ #
24
26
  ###############################################################################
25
27
  # runs 2 specs # runs 3 tests
26
28
  ###############################################################################
@@ -33,7 +35,7 @@ class ThingySpec < Minitest::Spec
33
35
  end
34
36
 
35
37
  def test_should_do_the_first_thing
36
- assert_equal 1, 1
38
+ _(1).must_equal 1
37
39
  end
38
40
  end
39
41
 
@@ -47,6 +49,6 @@ class SubThingySpec < ThingySpec
47
49
  remove_method :test_should_do_the_first_thing
48
50
 
49
51
  def test_should_do_the_second_thing
50
- assert_equal 2, 2
52
+ _(2).must_equal 2
51
53
  end
52
54
  end
data/lib/hoe/minitest.rb CHANGED
@@ -11,7 +11,8 @@ module Hoe::Minitest
11
11
 
12
12
  def initialize_minitest
13
13
  unless minitest? then
14
- dir = "../../minitest/dev/lib"
14
+ dir = File.expand_path "../..", __FILE__
15
+
15
16
  Hoe.add_include_dirs dir if File.directory? dir
16
17
  end
17
18
 
@@ -62,11 +62,11 @@ module Minitest
62
62
  return "Expected: #{mu_pp exp}\n Actual: #{mu_pp act}" unless
63
63
  expect
64
64
 
65
- Tempfile.open "expect" do |a|
65
+ Tempfile.create "expect" do |a|
66
66
  a.puts expect
67
67
  a.flush
68
68
 
69
- Tempfile.open "butwas" do |b|
69
+ Tempfile.create "butwas" do |b|
70
70
  b.puts butwas
71
71
  b.flush
72
72
 
@@ -196,6 +196,12 @@ module Minitest
196
196
  .split(":in ", 2).first # clean up noise
197
197
  end
198
198
 
199
+ def _caller_uplevel # :nodoc:
200
+ backtrace = caller
201
+ real_caller = Minitest.filter_backtrace(caller).first
202
+ backtrace.index(real_caller)
203
+ end
204
+
199
205
  E = "" # :nodoc:
200
206
 
201
207
  ##
@@ -219,7 +225,7 @@ module Minitest
219
225
  if Minitest::VERSION >= "6" then
220
226
  refute_nil exp, "Use assert_nil if expecting nil."
221
227
  else
222
- warn "DEPRECATED: Use assert_nil if expecting nil from #{_where}. This will fail in Minitest 6."
228
+ warn "DEPRECATED: Use assert_nil if expecting nil. This will fail in Minitest 6.", uplevel: _caller_uplevel
223
229
  end
224
230
  end
225
231
 
@@ -368,15 +374,12 @@ module Minitest
368
374
  # error.
369
375
 
370
376
  def assert_pattern
371
- raise NotImplementedError, "only available in Ruby 3.0+" unless RUBY_VERSION >= "3.0"
372
377
  flunk "assert_pattern requires a block to capture errors." unless block_given?
373
378
 
374
- begin # TODO: remove after ruby 2.6 dropped
375
- yield
376
- pass
377
- rescue NoMatchingPatternError => e
378
- flunk e.message
379
- end
379
+ yield
380
+ pass
381
+ rescue NoMatchingPatternError => e
382
+ flunk e.message
380
383
  end
381
384
 
382
385
  ##
@@ -471,7 +474,7 @@ module Minitest
471
474
  # Fails unless the call returns a true value
472
475
 
473
476
  def assert_send send_ary, m = nil
474
- warn "DEPRECATED: assert_send. From #{_where}"
477
+ warn "DEPRECATED: assert_send.", uplevel: _caller_uplevel
475
478
 
476
479
  recv, msg, *args = send_ary
477
480
  m = message(m) {
@@ -500,14 +503,9 @@ module Minitest
500
503
  value = catch sym do
501
504
  begin
502
505
  yield
503
- rescue ThreadError => e # wtf?!? 1.8 + threads == suck
504
- default += ", not :#{e.message[/uncaught throw \`(\w+?)\'/, 1]}"
505
- rescue ArgumentError => e # 1.9 exception
506
+ rescue ArgumentError => e # 1.9+ exception
506
507
  raise e unless e.message.include? "uncaught throw"
507
508
  default += ", not #{e.message.split(/ /).last}"
508
- rescue NameError => e # 1.8 exception
509
- raise e unless e.name == sym
510
- default += ", not #{e.name.inspect}"
511
509
  end
512
510
  caught = false
513
511
  end
@@ -692,8 +690,8 @@ module Minitest
692
690
  # For comparing Floats. Fails if +exp+ and +act+ have a relative error
693
691
  # less than +epsilon+.
694
692
 
695
- def refute_in_epsilon a, b, epsilon = 0.001, msg = nil
696
- refute_in_delta a, b, a * epsilon, msg
693
+ def refute_in_epsilon exp, act, epsilon = 0.001, msg = nil
694
+ refute_in_delta exp, act, [exp.abs, act.abs].min * epsilon, msg
697
695
  end
698
696
 
699
697
  ##
@@ -756,15 +754,12 @@ module Minitest
756
754
  # other exceptions will be raised as normal and generate a test error.
757
755
 
758
756
  def refute_pattern
759
- raise NotImplementedError, "only available in Ruby 3.0+" unless RUBY_VERSION >= "3.0"
760
757
  flunk "refute_pattern requires a block to capture errors." unless block_given?
761
758
 
762
- begin
763
- yield
764
- flunk "NoMatchingPatternError expected, but nothing was raised."
765
- rescue NoMatchingPatternError
766
- pass
767
- end
759
+ yield
760
+ flunk "NoMatchingPatternError expected, but nothing was raised."
761
+ rescue NoMatchingPatternError
762
+ pass
768
763
  end
769
764
 
770
765
  ##
@@ -1,6 +1,6 @@
1
- require "minitest"
2
- require "minitest/spec"
3
- require "minitest/mock"
4
- require "minitest/hell" if ENV["MT_HELL"]
1
+ require_relative "../minitest"
2
+ require_relative "spec"
3
+ require_relative "mock"
4
+ require_relative "hell" if ENV["MT_HELL"]
5
5
 
6
6
  Minitest.autorun
@@ -1,5 +1,5 @@
1
- require "minitest/test"
2
- require "minitest/spec"
1
+ require_relative "test"
2
+ require_relative "spec"
3
3
 
4
4
  module Minitest
5
5
  ##
@@ -125,7 +125,7 @@ module Minitest::Expectations
125
125
  infect_an_assertion :assert_output, :must_output, :block
126
126
 
127
127
  ##
128
- # See Minitest::Assertions#assert_pattern_match
128
+ # See Minitest::Assertions#assert_pattern
129
129
  #
130
130
  # _ { ... }.must_pattern_match [...]
131
131
  #
@@ -293,7 +293,7 @@ module Minitest::Expectations
293
293
  infect_an_assertion :refute_operator, :wont_be, :reverse
294
294
 
295
295
  ##
296
- # See Minitest::Assertions#refute_pattern_match
296
+ # See Minitest::Assertions#refute_pattern
297
297
  #
298
298
  # _ { ... }.wont_pattern_match [...]
299
299
  #
data/lib/minitest/hell.rb CHANGED
@@ -1,4 +1,4 @@
1
- require "minitest/parallel"
1
+ require_relative "parallel"
2
2
 
3
3
  class Minitest::Test
4
4
  parallelize_me!
@@ -1,4 +1,4 @@
1
- require "minitest"
1
+ require_relative "../minitest"
2
2
 
3
3
  ARGV << "--no-plugins"
4
4
 
data/lib/minitest/mock.rb CHANGED
@@ -33,17 +33,9 @@ module Minitest # :nodoc:
33
33
  old_w, $-w = $-w, nil
34
34
  define_method method_id do |*args, **kwargs, &b|
35
35
  if @expected_calls.key? method_id then
36
- if kwargs.empty? then # FIX: drop this after 2.7 dead
37
- method_missing(method_id, *args, &b)
38
- else
39
- method_missing(method_id, *args, **kwargs, &b)
40
- end
36
+ method_missing(method_id, *args, **kwargs, &b)
41
37
  else
42
- if kwargs.empty? then # FIX: drop this after 2.7 dead
43
- super(*args, &b)
44
- else
45
- super(*args, **kwargs, &b)
46
- end
38
+ super(*args, **kwargs, &b)
47
39
  end
48
40
  end
49
41
  ensure
@@ -155,11 +147,7 @@ module Minitest # :nodoc:
155
147
  def method_missing sym, *args, **kwargs, &block # :nodoc:
156
148
  unless @expected_calls.key? sym then
157
149
  if @delegator && @delegator.respond_to?(sym)
158
- if kwargs.empty? then # FIX: drop this after 2.7 dead
159
- return @delegator.public_send(sym, *args, &block)
160
- else
161
- return @delegator.public_send(sym, *args, **kwargs, &block)
162
- end
150
+ return @delegator.public_send(sym, *args, **kwargs, &block)
163
151
  else
164
152
  raise NoMethodError, "unmocked method %p, expected one of %p" %
165
153
  [sym, @expected_calls.keys.sort_by(&:to_s)]
@@ -320,18 +308,10 @@ class Object
320
308
  else
321
309
  metaclass.send :define_method, name do |*args, **kwargs, &blk|
322
310
  if val_or_callable.respond_to? :call then
323
- if kwargs.empty? then # FIX: drop this after 2.7 dead
324
- val_or_callable.call(*args, &blk)
325
- else
326
- val_or_callable.call(*args, **kwargs, &blk)
327
- end
311
+ val_or_callable.call(*args, **kwargs, &blk)
328
312
  else
329
313
  if blk then
330
- if block_kwargs.empty? then # FIX: drop this after 2.7 dead
331
- blk.call(*block_args)
332
- else
333
- blk.call(*block_args, **block_kwargs)
334
- end
314
+ blk.call(*block_args, **block_kwargs)
335
315
  end
336
316
  val_or_callable
337
317
  end
@@ -1,3 +1,5 @@
1
+ require "thread"
2
+
1
3
  module Minitest
2
4
  module Parallel # :nodoc:
3
5
 
@@ -1,4 +1,4 @@
1
- require "minitest"
1
+ require_relative "../minitest"
2
2
 
3
3
  Minitest.load_plugins
4
4
  Minitest::PrideIO.pride!
@@ -1,4 +1,4 @@
1
- require "minitest"
1
+ require_relative "../minitest"
2
2
 
3
3
  module Minitest
4
4
  def self.plugin_pride_options opts, _options # :nodoc:
data/lib/minitest/spec.rb CHANGED
@@ -1,4 +1,4 @@
1
- require "minitest/test"
1
+ require_relative "test"
2
2
 
3
3
  class Module # :nodoc:
4
4
  def infect_an_assertion meth, new_name, dont_flip = false # :nodoc:
@@ -38,7 +38,11 @@ class Module # :nodoc:
38
38
  end
39
39
  end
40
40
 
41
- Minitest::Expectation = Struct.new :target, :ctx # :nodoc:
41
+ # :stopdoc:
42
+ module Minitest # fucking hell rdoc...
43
+ Expectation = Struct.new :target, :ctx
44
+ end
45
+ # :startdoc:
42
46
 
43
47
  ##
44
48
  # Kernel extensions for minitest
@@ -285,9 +289,8 @@ class Minitest::Spec < Minitest::Test
285
289
  defined?(@name) ? @name : super
286
290
  end
287
291
 
288
- def to_s # :nodoc:
289
- name # Can't alias due to 1.8.7, not sure why
290
- end
292
+ alias to_s name
293
+ alias inspect name
291
294
 
292
295
  attr_reader :desc # :nodoc:
293
296
  alias specify it
@@ -343,7 +346,7 @@ class Minitest::Spec < Minitest::Test
343
346
  TYPES = DSL::TYPES # :nodoc:
344
347
  end
345
348
 
346
- require "minitest/expectations"
349
+ require_relative "expectations"
347
350
 
348
351
  class Object # :nodoc:
349
352
  include Minitest::Expectations unless ENV["MT_NO_EXPECTATIONS"]
data/lib/minitest/test.rb CHANGED
@@ -1,4 +1,4 @@
1
- require "minitest" unless defined? Minitest::Runnable
1
+ require_relative "../minitest" unless defined? Minitest::Runnable
2
2
 
3
3
  module Minitest
4
4
  ##
@@ -8,9 +8,9 @@ module Minitest
8
8
  # See Minitest::Assertions
9
9
 
10
10
  class Test < Runnable
11
- require "minitest/assertions"
12
- include Minitest::Assertions
11
+ require_relative "assertions"
13
12
  include Minitest::Reportable
13
+ include Minitest::Assertions
14
14
 
15
15
  def class_name # :nodoc:
16
16
  self.class.name # for Minitest::Reportable
@@ -58,6 +58,7 @@ module Minitest
58
58
  # tests are awesome.
59
59
 
60
60
  def self.parallelize_me!
61
+ return unless Minitest.parallel_executor
61
62
  include Minitest::Parallel::Test
62
63
  extend Minitest::Parallel::Test::ClassMethods
63
64
  end
@@ -234,4 +235,4 @@ module Minitest
234
235
  end # Test
235
236
  end
236
237
 
237
- require "minitest/unit" if ENV["MT_COMPAT"] # compatibility layer only
238
+ require_relative "unit" if ENV["MT_COMPAT"] # compatibility layer only
@@ -44,8 +44,16 @@ module Minitest # :nodoc:
44
44
  WINDOWS = RbConfig::CONFIG["host_os"] =~ /mswin|mingw/ # :nodoc:
45
45
 
46
46
  ##
47
- # Create several test-oriented tasks under +name+. Takes an
48
- # optional block to customize variables.
47
+ # Create several test-oriented tasks under +name+ (default:
48
+ # "test"). Takes an optional block to customize variables.
49
+ # Examples:
50
+ #
51
+ # Minitest::TestTask.create # named "test", all defaults
52
+ #
53
+ # Minitest::TestTask.create do |t|
54
+ # t.warning = false # my tests are noisy
55
+ # t.framework = %(require_relative "./test/helper.rb")
56
+ # end
49
57
 
50
58
  def self.create name = :test, &block
51
59
  task = new name
@@ -69,9 +77,18 @@ module Minitest # :nodoc:
69
77
 
70
78
  ##
71
79
  # The code to load the framework. Defaults to requiring
72
- # minitest/autorun...
80
+ # minitest/autorun.
81
+ #
82
+ # If you have a test helper file that requires minitest/autorun
83
+ # and anything else your project standardizes on, then you'll
84
+ # probably want to change this to:
85
+ #
86
+ # Minitest::TestTask.create do |t|
87
+ # t.framework = %(require_relative "./test/helper.rb")
88
+ # end
73
89
  #
74
- # Why do I have this as an option?
90
+ # or something similar. NOTE: if you do this, then helper must
91
+ # require "minitest/autorun" at the top to start the tests.
75
92
 
76
93
  attr_accessor :framework
77
94
 
@@ -100,6 +117,11 @@ module Minitest # :nodoc:
100
117
 
101
118
  ##
102
119
  # Optional: Additional ruby to run before the test framework is loaded.
120
+ # Example:
121
+ #
122
+ # Minitest::TestTask.create "test:cov" do |t|
123
+ # t.test_prelude = %(require "simplecov")
124
+ # end
103
125
 
104
126
  attr_accessor :test_prelude
105
127
 
@@ -281,13 +303,8 @@ module Minitest # :nodoc:
281
303
  end
282
304
 
283
305
  class Work < Queue # :nodoc:
284
- def initialize jobs = [] # :nodoc:
285
- super()
286
-
287
- jobs.each do |job|
288
- self << job
289
- end
290
-
306
+ def initialize jobs # :nodoc:
307
+ super
291
308
  close
292
309
  end
293
310
  end
data/lib/minitest/unit.rb CHANGED
@@ -11,7 +11,7 @@ unless defined?(Minitest) then
11
11
  module Minitest # :nodoc:
12
12
  end
13
13
  MiniTest = Minitest # :nodoc: # prevents minitest.rb from requiring back to us
14
- require "minitest"
14
+ require_relative "../minitest"
15
15
  end
16
16
 
17
17
  MiniTest = Minitest unless defined?(MiniTest)