minitest 5.26.1 → 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: 99c81ecf40f2e6edde9201cded0808484223cdf20d3e819e1b043e50bcc2564c
4
- data.tar.gz: 543e61e5ac5da94ddbaaa51969b0b5dbf2ea91b400c13fd88830396a22627867
3
+ metadata.gz: f9144898bc998f49d23688386cb435165b7ba6fadf83acc47f8120992d2799c6
4
+ data.tar.gz: f90178ecc10c76e8d0cea4c2206972b3bbb899f552c53f1b22743e00d9898a02
5
5
  SHA512:
6
- metadata.gz: 1e73adb8391043dc989b7dd2c307f5e5af72f2f2e51ef1e0fda7654cff90755fd920e2003f86ef0fa62bae2fbc9e9ec9a7a6bea76abc6a46c5b7f0500fa5b337
7
- data.tar.gz: 3a860d654d72db62a86397b6849fa5509e21e5f5a021e920b0bca46d147cd8f5d7d5203ad28eb73b22b2a643683db0e8fa8948437688ec18642ef21666e3095f
6
+ metadata.gz: a157620a20602d17c8aaf088cc9c709401d7fd3507569fceb85d358c5519596fdb2bd71ef8b1b597942ba9ba5ef9b0af1530fb97a47fac28add36600516d2edc
7
+ data.tar.gz: 17c0fdb228c63bda818fbc4009c30c88138df74e325e087050843bef8128ea54afade9de4c0e5af6d5f734ad114d34dd97e4eed2ac4e577662144ad8c49f261e
checksums.yaml.gz.sig CHANGED
Binary file
data/History.rdoc CHANGED
@@ -1,3 +1,13 @@
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
+
1
11
  === 5.26.1 / 2025-11-08
2
12
 
3
13
  The Ocean Shores, Slightly Less Tipsy Edition!
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
 
@@ -427,13 +428,10 @@ Current versions of rails: (https://endoflife.date/rails)
427
428
 
428
429
  | rails | min ruby | minitest | status | EOL Date |
429
430
  |-------+----------+----------+----------+------------|
431
+ | 8.1 | >= 3.2 | >= 5.1 | Current | 2027-10-07 |
430
432
  | 8.0 | >= 3.2 | >= 5.1 | Current | 2026-11-07 |
431
- | 7.2 | >= 3.1 | >= 5.1 | Current | 2026-08-09 |
432
- | 7.1 | >= 2.7 | >= 5.1 | Security | 2025-10-01 |
433
- | 7.0 | >= 2.7 | >= 5.1 | Security | 2025-04-01 |
434
- | 6.1 | >= 2.5 | >= 5.1 | EOL | 2024-10-01 |
435
- | 6.0 | >= 2.5 | >= 5.1 | EOL | 2023-06-01 |
436
- | 5.2 | >= 2.2.2 | ~> 5.1 | EOL | 2022-06-01 |
433
+ | 7.2 | >= 3.1 | >= 5.1 | Security | 2026-08-09 |
434
+ | 7.1 | >= 2.7 | >= 5.1 | EOL | 2025-10-01 |
437
435
 
438
436
  If you want to look at the requirements for a specific version, run:
439
437
 
data/Rakefile CHANGED
@@ -11,7 +11,24 @@ Hoe.spec "minitest" do
11
11
 
12
12
  license "MIT"
13
13
 
14
- require_ruby_version ">= 2.7"
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
15
32
  end
16
33
 
17
34
  desc "Find missing expectations"
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
 
@@ -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) {
@@ -687,8 +690,8 @@ module Minitest
687
690
  # For comparing Floats. Fails if +exp+ and +act+ have a relative error
688
691
  # less than +epsilon+.
689
692
 
690
- def refute_in_epsilon a, b, epsilon = 0.001, msg = nil
691
- 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
692
695
  end
693
696
 
694
697
  ##
@@ -751,15 +754,12 @@ module Minitest
751
754
  # other exceptions will be raised as normal and generate a test error.
752
755
 
753
756
  def refute_pattern
754
- raise NotImplementedError, "only available in Ruby 3.0+" unless RUBY_VERSION >= "3.0"
755
757
  flunk "refute_pattern requires a block to capture errors." unless block_given?
756
758
 
757
- begin
758
- yield
759
- flunk "NoMatchingPatternError expected, but nothing was raised."
760
- rescue NoMatchingPatternError
761
- pass
762
- end
759
+ yield
760
+ flunk "NoMatchingPatternError expected, but nothing was raised."
761
+ rescue NoMatchingPatternError
762
+ pass
763
763
  end
764
764
 
765
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
  ##
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,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:
@@ -290,6 +290,7 @@ class Minitest::Spec < Minitest::Test
290
290
  end
291
291
 
292
292
  alias to_s name
293
+ alias inspect name
293
294
 
294
295
  attr_reader :desc # :nodoc:
295
296
  alias specify it
@@ -345,7 +346,7 @@ class Minitest::Spec < Minitest::Test
345
346
  TYPES = DSL::TYPES # :nodoc:
346
347
  end
347
348
 
348
- require "minitest/expectations"
349
+ require_relative "expectations"
349
350
 
350
351
  class Object # :nodoc:
351
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,7 +8,7 @@ module Minitest
8
8
  # See Minitest::Assertions
9
9
 
10
10
  class Test < Runnable
11
- require "minitest/assertions"
11
+ require_relative "assertions"
12
12
  include Minitest::Reportable
13
13
  include Minitest::Assertions
14
14
 
@@ -235,4 +235,4 @@ module Minitest
235
235
  end # Test
236
236
  end
237
237
 
238
- require "minitest/unit" if ENV["MT_COMPAT"] # compatibility layer only
238
+ require_relative "unit" if ENV["MT_COMPAT"] # compatibility layer only
@@ -303,13 +303,8 @@ module Minitest # :nodoc:
303
303
  end
304
304
 
305
305
  class Work < Queue # :nodoc:
306
- def initialize jobs = [] # :nodoc:
307
- super()
308
-
309
- jobs.each do |job|
310
- self << job
311
- end
312
-
306
+ def initialize jobs # :nodoc:
307
+ super
313
308
  close
314
309
  end
315
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)
data/lib/minitest.rb CHANGED
@@ -10,7 +10,7 @@ require_relative "minitest/compress"
10
10
  # runtime. See +Minitest.run+ for more information.
11
11
 
12
12
  module Minitest
13
- VERSION = "5.26.1" # :nodoc:
13
+ VERSION = "5.26.2" # :nodoc:
14
14
 
15
15
  @@installed_at_exit ||= false
16
16
  @@after_run = []
@@ -68,8 +68,7 @@ module Minitest
68
68
  # Registers Minitest to run at process exit
69
69
 
70
70
  def self.autorun
71
- Warning[:deprecated] = true if
72
- Object.const_defined?(:Warning) && Warning.respond_to?(:[]=)
71
+ Warning[:deprecated] = true
73
72
 
74
73
  at_exit {
75
74
  next if $! and not ($!.kind_of? SystemExit and $!.success?)
@@ -147,26 +146,32 @@ module Minitest
147
146
  orig_args = args.dup
148
147
 
149
148
  OptionParser.new do |opts|
150
- opts.banner = "minitest options:"
149
+ opts.program_name = "minitest"
151
150
  opts.version = Minitest::VERSION
152
151
 
152
+ opts.banner = [
153
+ "Usage: rake test [A=options] (see Minitest::TestTask for more options)",
154
+ "minitest [paths] [options] (with minitest-sprint gem)",
155
+ "ruby path/to/test.rb [options]\n\n",
156
+ ].join "\n or: "
157
+
153
158
  opts.on "-h", "--help", "Display this help." do
154
159
  puts opts
155
160
  exit
156
161
  end
157
162
 
158
- opts.on "--no-plugins", "Bypass minitest plugin auto-loading (or set $MT_NO_PLUGINS)."
163
+ opts.on "--no-plugins", "Bypass minitest plugin auto-loading (or env: MT_NO_PLUGINS=1)."
159
164
 
160
- desc = "Sets random seed. Also via env. Eg: SEED=n rake"
165
+ desc = "Sets random seed. Also via env, eg: SEED=42"
161
166
  opts.on "-s", "--seed SEED", Integer, desc do |m|
162
- options[:seed] = m.to_i
167
+ options[:seed] = m
163
168
  end
164
169
 
165
- opts.on "-v", "--verbose", "Verbose. Show progress processing files." do
170
+ opts.on "-v", "--verbose", "Verbose. Print each name as they run." do
166
171
  options[:verbose] = true
167
172
  end
168
173
 
169
- opts.on "-q", "--quiet", "Quiet. Show no progress processing files." do
174
+ opts.on "-q", "--quiet", "Quiet. Show no dots while processing files." do
170
175
  options[:quiet] = true
171
176
  end
172
177
 
@@ -174,7 +179,7 @@ module Minitest
174
179
  options[:show_skips] = true
175
180
  end
176
181
 
177
- opts.on "-n", "--name PATTERN", "Filter run on /regexp/ or string." do |a|
182
+ opts.on "-n", "--name PATTERN", "Include /regexp/ or string for run." do |a|
178
183
  options[:filter] = a
179
184
  end
180
185
 
@@ -182,21 +187,28 @@ module Minitest
182
187
  options[:exclude] = a
183
188
  end
184
189
 
190
+ # part of my unofficial embedded gem "makeoptparseworkwell"
191
+ def opts.topdict(name) = (name.length > 1 ? top.long : top.short)
192
+ def opts.alias(from, to) = (dict = topdict(from) ; dict[to] = dict[from])
193
+
194
+ # these will work but won't show up in --help output:
195
+ opts.alias "name", "include"
196
+ opts.alias "n", "i"
197
+ opts.alias "e", "x"
198
+
185
199
  opts.on "-S", "--skip CODES", String, "Skip reporting of certain types of results (eg E)." do |s|
186
200
  options[:skip] = s.chars.to_a
187
201
  end
188
202
 
189
- ruby27plus = ::Warning.respond_to? :[]=
190
-
191
203
  opts.on "-W[error]", String, "Turn Ruby warnings into errors" do |s|
192
204
  options[:Werror] = true
193
205
  case s
194
206
  when "error", "all", nil then
195
- require "minitest/error_on_warning"
207
+ require_relative "minitest/error_on_warning"
196
208
  $VERBOSE = true
197
- ::Warning[:deprecated] = true if ruby27plus
209
+ ::Warning[:deprecated] = true
198
210
  else
199
- ::Warning[s.to_sym] = true if ruby27plus # check validity of category
211
+ ::Warning[s.to_sym] = true # check validity of category
200
212
  end
201
213
  end
202
214
 
@@ -1235,4 +1247,4 @@ module Minitest
1235
1247
  # :startdoc:
1236
1248
  end
1237
1249
 
1238
- require "minitest/test"
1250
+ require_relative "minitest/test"
@@ -142,8 +142,7 @@ class TestMinitestAssertions < Minitest::Test
142
142
  exp[1] = Object.new
143
143
  act[1] = Object.new
144
144
  act_obj = act[1]
145
- # TODO: switch to endless when 2.7 is dropped
146
- act_obj.define_singleton_method(:inspect) { "#<Object:0xXXXXXX>" }
145
+ def act_obj.inspect = "#<Object:0xXXXXXX>"
147
146
  msg = <<~EOM.chomp % [act]
148
147
  No visible difference in the Hash#inspect output.
149
148
  You should look at the implementation of #== on Hash or its members.
@@ -292,7 +291,7 @@ class TestMinitestAssertions < Minitest::Test
292
291
  @tc.assert_equal nil, nil
293
292
  end
294
293
  else
295
- err_re = /Use assert_nil if expecting nil from .*test_minitest_\w+.rb/
294
+ err_re = /.*?test_minitest_\w+.rb:\d+: warning: DEPRECATED: Use assert_nil if expecting nil. This will fail in Minitest 6./
296
295
  err_re = "" if $-w.nil?
297
296
 
298
297
  assert_deprecation err_re do
@@ -1074,48 +1073,24 @@ class TestMinitestAssertions < Minitest::Test
1074
1073
  end
1075
1074
 
1076
1075
  def test_assert_pattern
1077
- if RUBY_VERSION > "3" then
1078
- @tc.assert_pattern do
1079
- exp = if RUBY_VERSION.start_with? "3.0"
1080
- "(eval):1: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!\n"
1081
- else
1082
- ""
1083
- end
1084
- assert_output nil, exp do
1085
- eval "[1,2,3] => [Integer, Integer, Integer]" # eval to escape parser for ruby<3
1086
- end
1087
- end
1088
- else
1089
- @assertion_count = 0
1090
-
1091
- assert_raises NotImplementedError do
1092
- @tc.assert_pattern do
1093
- # do nothing
1094
- end
1076
+ @tc.assert_pattern do
1077
+ assert_output nil, "" do
1078
+ [1,2,3] => [Integer, Integer, Integer]
1095
1079
  end
1096
1080
  end
1097
1081
  end
1098
1082
 
1099
1083
  def test_assert_pattern_traps_nomatchingpatternerror
1100
- skip unless RUBY_VERSION > "3"
1101
- exp = if RUBY_VERSION.start_with? "3.0" then
1102
- "[1, 2, 3]" # terrible error message!
1103
- else
1104
- /length mismatch/
1105
- end
1084
+ exp = /length mismatch/
1106
1085
 
1107
1086
  assert_triggered exp do
1108
1087
  @tc.assert_pattern do
1109
- capture_io do # 3.0 is noisy
1110
- eval "[1,2,3] => [Integer, Integer]" # eval to escape parser for ruby<3
1111
- end
1088
+ [1,2,3] => [Integer, Integer]
1112
1089
  end
1113
1090
  end
1114
1091
  end
1115
1092
 
1116
1093
  def test_assert_pattern_raises_other_exceptions
1117
- skip unless RUBY_VERSION >= "3.0"
1118
-
1119
1094
  @assertion_count = 0
1120
1095
 
1121
1096
  assert_raises RuntimeError do
@@ -1126,8 +1101,6 @@ class TestMinitestAssertions < Minitest::Test
1126
1101
  end
1127
1102
 
1128
1103
  def test_assert_pattern_with_no_block
1129
- skip unless RUBY_VERSION >= "3.0"
1130
-
1131
1104
  assert_triggered "assert_pattern requires a block to capture errors." do
1132
1105
  @tc.assert_pattern
1133
1106
  end
@@ -1280,12 +1253,16 @@ class TestMinitestAssertions < Minitest::Test
1280
1253
  end
1281
1254
 
1282
1255
  def test_refute_in_epsilon_triggered
1283
- assert_triggered "Expected |10000 - 9990| (10) to not be <= 10.0." do
1284
- @tc.refute_in_epsilon 10_000, 9990
1256
+ assert_triggered "Expected |10000 - 9991| (9) to not be <= 9.991." do
1257
+ @tc.refute_in_epsilon 10_000, 9991
1285
1258
  flunk
1286
1259
  end
1287
1260
  end
1288
1261
 
1262
+ def test_refute_in_epsilon_minimum
1263
+ @tc.refute_in_epsilon 10_000, 9990
1264
+ end
1265
+
1289
1266
  def test_refute_includes
1290
1267
  @assertion_count = 2
1291
1268
 
@@ -1382,38 +1359,20 @@ class TestMinitestAssertions < Minitest::Test
1382
1359
  end
1383
1360
 
1384
1361
  def test_refute_pattern
1385
- if RUBY_VERSION >= "3.0"
1386
- @tc.refute_pattern do
1387
- capture_io do # 3.0 is noisy
1388
- eval "[1,2,3] => [Integer, Integer, String]"
1389
- end
1390
- end
1391
- else
1392
- @assertion_count = 0
1393
-
1394
- assert_raises NotImplementedError do
1395
- @tc.refute_pattern do
1396
- eval "[1,2,3] => [Integer, Integer, String]"
1397
- end
1398
- end
1362
+ @tc.refute_pattern do
1363
+ [1,2,3] => [Integer, Integer, String]
1399
1364
  end
1400
1365
  end
1401
1366
 
1402
1367
  def test_refute_pattern_expects_nomatchingpatternerror
1403
- skip unless RUBY_VERSION > "3"
1404
-
1405
1368
  assert_triggered(/NoMatchingPatternError expected, but nothing was raised./) do
1406
1369
  @tc.refute_pattern do
1407
- capture_io do # 3.0 is noisy
1408
- eval "[1,2,3] => [Integer, Integer, Integer]"
1409
- end
1370
+ [1,2,3] => [Integer, Integer, Integer]
1410
1371
  end
1411
1372
  end
1412
1373
  end
1413
1374
 
1414
1375
  def test_refute_pattern_raises_other_exceptions
1415
- skip unless RUBY_VERSION >= "3.0"
1416
-
1417
1376
  @assertion_count = 0
1418
1377
 
1419
1378
  assert_raises RuntimeError do
@@ -1424,8 +1383,6 @@ class TestMinitestAssertions < Minitest::Test
1424
1383
  end
1425
1384
 
1426
1385
  def test_refute_pattern_with_no_block
1427
- skip unless RUBY_VERSION >= "3.0"
1428
-
1429
1386
  assert_triggered "refute_pattern requires a block to capture errors." do
1430
1387
  @tc.refute_pattern
1431
1388
  end
@@ -368,11 +368,7 @@ class TestMinitestMock < Minitest::Test
368
368
  end
369
369
 
370
370
  assert_silent do
371
- if RUBY_VERSION > "3" then
372
- mock.foo arg1, arg2, arg3
373
- else
374
- mock.foo arg1, arg2, **arg3 # oddity just for ruby 2.7
375
- end
371
+ mock.foo arg1, arg2, arg3
376
372
  end
377
373
 
378
374
  assert_mock mock
@@ -401,8 +397,8 @@ class TestMinitestMock < Minitest::Test
401
397
  mock.foo k1: arg1, k2: arg2
402
398
  end
403
399
 
404
- # basically testing ruby ... need ? for ruby < 2.7 :(
405
- assert_match(/missing keyword: :?k3/, e.message)
400
+ # basically testing ruby
401
+ assert_match(/missing keyword: :k3/, e.message)
406
402
  end
407
403
 
408
404
  def test_mock_block_is_passed_keyword_args__block_bad_extra
@@ -416,8 +412,7 @@ class TestMinitestMock < Minitest::Test
416
412
  mock.foo k1: arg1, k2: arg2, k3: arg3
417
413
  end
418
414
 
419
- # basically testing ruby ... need ? for ruby < 2.7 :(
420
- assert_match(/unknown keyword: :?k3/, e.message)
415
+ assert_match(/unknown keyword: :k3/, e.message)
421
416
  end
422
417
 
423
418
  def test_mock_block_is_passed_keyword_args__block_bad_value
@@ -656,7 +651,7 @@ class TestMinitestMock < Minitest::Test
656
651
 
657
652
  end
658
653
 
659
- require "minitest/metametameta"
654
+ require_relative "metametameta"
660
655
 
661
656
  class TestMinitestStub < Minitest::Test
662
657
  # Do not parallelize since we're calling stub on class methods
@@ -1,5 +1,5 @@
1
1
  require "minitest/autorun"
2
- require "minitest/metametameta"
2
+ require_relative "metametameta"
3
3
  require "forwardable"
4
4
 
5
5
  class FakeTest < Minitest::Test
@@ -29,10 +29,11 @@ class TestMinitestReporter < MetaMetaMetaTestCase
29
29
  super
30
30
  self.io = StringIO.new(+"")
31
31
  self.r = new_composite_reporter
32
+ @et = @ft = @pt = @st = @sse = nil
32
33
  end
33
34
 
34
35
  def error_test
35
- unless defined? @et then
36
+ unless @et then
36
37
  @et = FakeTest.new :woot
37
38
  @et.failures << Minitest::UnexpectedError.new(begin
38
39
  raise "no"
@@ -45,7 +46,7 @@ class TestMinitestReporter < MetaMetaMetaTestCase
45
46
  end
46
47
 
47
48
  def system_stack_error_test
48
- unless defined? @sse then
49
+ unless @sse then
49
50
 
50
51
  ex = SystemStackError.new
51
52
 
@@ -64,7 +65,7 @@ class TestMinitestReporter < MetaMetaMetaTestCase
64
65
  end
65
66
 
66
67
  def fail_test
67
- unless defined? @ft then
68
+ unless @ft then
68
69
  @ft = FakeTest.new :woot
69
70
  @ft.failures << begin
70
71
  raise Minitest::Assertion, "boo"
@@ -87,7 +88,7 @@ class TestMinitestReporter < MetaMetaMetaTestCase
87
88
  end
88
89
 
89
90
  def skip_test
90
- unless defined? @st then
91
+ unless @st then
91
92
  @st = FakeTest.new :woot
92
93
  @st.failures << begin
93
94
  raise Minitest::Skip
@@ -1,4 +1,4 @@
1
- require "minitest/metametameta"
1
+ require_relative "metametameta"
2
2
  require "stringio"
3
3
 
4
4
  class MiniSpecA < Minitest::Spec; end
@@ -148,25 +148,13 @@ describe Minitest::Spec do
148
148
  it "needs to pattern match" do
149
149
  @assertion_count = 1
150
150
 
151
- if RUBY_VERSION > "3" then
152
- expect { good_pattern }.must_pattern_match
153
- else
154
- assert_raises NotImplementedError do
155
- expect {}.must_pattern_match
156
- end
157
- end
151
+ expect { good_pattern }.must_pattern_match
158
152
  end
159
153
 
160
154
  it "needs to error on bad pattern match" do
161
- skip unless RUBY_VERSION > "3"
162
-
163
155
  @assertion_count = 1
164
156
 
165
- exp = if RUBY_VERSION.start_with? "3.0"
166
- "[1, 2, 3]" # terrible error message!
167
- else
168
- /length mismatch/
169
- end
157
+ exp = /length mismatch/
170
158
 
171
159
  assert_triggered exp do
172
160
  expect { bad_pattern }.must_pattern_match
@@ -284,7 +272,7 @@ describe Minitest::Spec do
284
272
  @assertion_count = 3
285
273
  @assertion_count += 2 unless error_on_warn? # 2 extra assertions
286
274
 
287
- exp = /DEPRECATED: Use assert_nil if expecting nil from .* This will fail in Minitest 6./
275
+ exp = /.*?test_minitest_\w+.rb:\d+: warning: DEPRECATED: Use assert_nil if expecting nil. This will fail in Minitest 6./
288
276
 
289
277
  assert_deprecation exp do
290
278
  assert_success _(nil).must_equal(nil)
@@ -939,6 +927,16 @@ class TestMeta < MetaMetaMetaTestCase
939
927
  assert_equal "ExampleB::random_method::addl_context", spec_c.name
940
928
  end
941
929
 
930
+ def test_inspect
931
+ spec_a = describe ExampleA do; end
932
+ spec_b = describe ExampleB, :random_method do; end
933
+ spec_c = describe ExampleB, :random_method, :addl_context do; end
934
+
935
+ assert_equal "ExampleA", spec_a.inspect
936
+ assert_equal "ExampleB::random_method", spec_b.inspect
937
+ assert_equal "ExampleB::random_method::addl_context", spec_c.inspect
938
+ end
939
+
942
940
  def test_name2
943
941
  assert_equal "NamedExampleA", NamedExampleA.name
944
942
  assert_equal "NamedExampleB", NamedExampleB.name
@@ -1,4 +1,4 @@
1
- require "minitest/metametameta"
1
+ require_relative "metametameta"
2
2
 
3
3
  e = Encoding.default_external
4
4
  if e != Encoding::UTF_8 then
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minitest
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.26.1
4
+ version: 5.27.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Davis
@@ -159,13 +159,29 @@ files:
159
159
  - test/minitest/test_minitest_spec.rb
160
160
  - test/minitest/test_minitest_test.rb
161
161
  - test/minitest/test_minitest_test_task.rb
162
- homepage: https://github.com/minitest/minitest
162
+ homepage: https://minite.st/
163
163
  licenses:
164
164
  - MIT
165
165
  metadata:
166
- homepage_uri: https://github.com/minitest/minitest
166
+ homepage_uri: https://minite.st/
167
+ source_code_uri: https://github.com/minitest/minitest
167
168
  bug_tracker_uri: https://github.com/minitest/minitest/issues
168
169
  changelog_uri: https://github.com/minitest/minitest/blob/master/History.rdoc
170
+ post_install_message: |
171
+ NOTE: minitest 5 will be the last in the minitest family to support
172
+ ruby 1.8 to 2.7. If you need to keep using these versions,
173
+ you need to pin your dependency to minitest with something
174
+ like "~> 5.0". See History.rdoc to locate compatible
175
+ versions.
176
+
177
+ Further, minitest 6 will be dropping the following:
178
+
179
+ + MiniTest (it's been Minitest for >10 years)
180
+ + MiniTest::Unit
181
+ + MiniTest::Unit::TestCase
182
+ + assert_send (unless you argue for it well)
183
+ + assert_equal nil, obj
184
+ + mocks and stubs: moving minitest/mock.rb to its own gem
169
185
  rdoc_options:
170
186
  - "--main"
171
187
  - README.rdoc
@@ -175,7 +191,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
175
191
  requirements:
176
192
  - - ">="
177
193
  - !ruby/object:Gem::Version
178
- version: '2.7'
194
+ version: '3.1'
179
195
  required_rubygems_version: !ruby/object:Gem::Requirement
180
196
  requirements:
181
197
  - - ">="
metadata.gz.sig CHANGED
Binary file