minitest 5.26.1 → 5.26.2
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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data/History.rdoc +10 -0
- data/README.rdoc +3 -6
- data/Rakefile +1 -1
- data/lib/hoe/minitest.rb +2 -1
- data/lib/minitest/assertions.rb +2 -2
- data/lib/minitest/mock.rb +5 -25
- data/lib/minitest/spec.rb +1 -0
- data/lib/minitest.rb +25 -12
- data/test/minitest/test_minitest_assertions.rb +7 -4
- data/test/minitest/test_minitest_mock.rb +4 -9
- data/test/minitest/test_minitest_spec.rb +10 -0
- data.tar.gz.sig +0 -0
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0b434a6ca2a7c9344e640e80ea64a4b5b1849f8b6afa49c6f00766c2be0d4860
|
|
4
|
+
data.tar.gz: 84ae1cd082c17c1abca248bfbe841ca362c9bcb96e97c64eb524b6e46a50f94b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 592d2b5d8f7e33ea2c7ae8e598686df07108cd6bf3ae01bdc86871d16d17708db778716edfedb9bd6723972b7191615c9d29af7dba9b2231a70f0da394787c71
|
|
7
|
+
data.tar.gz: 407d3eb51b95f993a6809aa15ffbfa0630d31f0f18cf01854a2c68441fcda0555fdb2d2c83f41f7e605c8d4d4ade40e3785480f035e22492a54038e26900f0e7
|
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
|
@@ -427,13 +427,10 @@ Current versions of rails: (https://endoflife.date/rails)
|
|
|
427
427
|
|
|
428
428
|
| rails | min ruby | minitest | status | EOL Date |
|
|
429
429
|
|-------+----------+----------+----------+------------|
|
|
430
|
+
| 8.1 | >= 3.2 | >= 5.1 | Current | 2027-10-07 |
|
|
430
431
|
| 8.0 | >= 3.2 | >= 5.1 | Current | 2026-11-07 |
|
|
431
|
-
| 7.2 | >= 3.1 | >= 5.1 |
|
|
432
|
-
| 7.1 | >= 2.7 | >= 5.1 |
|
|
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 |
|
|
432
|
+
| 7.2 | >= 3.1 | >= 5.1 | Security | 2026-08-09 |
|
|
433
|
+
| 7.1 | >= 2.7 | >= 5.1 | EOL | 2025-10-01 |
|
|
437
434
|
|
|
438
435
|
If you want to look at the requirements for a specific version, run:
|
|
439
436
|
|
data/Rakefile
CHANGED
data/lib/hoe/minitest.rb
CHANGED
data/lib/minitest/assertions.rb
CHANGED
|
@@ -687,8 +687,8 @@ module Minitest
|
|
|
687
687
|
# For comparing Floats. Fails if +exp+ and +act+ have a relative error
|
|
688
688
|
# less than +epsilon+.
|
|
689
689
|
|
|
690
|
-
def refute_in_epsilon
|
|
691
|
-
refute_in_delta
|
|
690
|
+
def refute_in_epsilon exp, act, epsilon = 0.001, msg = nil
|
|
691
|
+
refute_in_delta exp, act, [exp.abs, act.abs].min * epsilon, msg
|
|
692
692
|
end
|
|
693
693
|
|
|
694
694
|
##
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
data/lib/minitest/spec.rb
CHANGED
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.
|
|
13
|
+
VERSION = "5.26.2" # :nodoc:
|
|
14
14
|
|
|
15
15
|
@@installed_at_exit ||= false
|
|
16
16
|
@@after_run = []
|
|
@@ -147,26 +147,32 @@ module Minitest
|
|
|
147
147
|
orig_args = args.dup
|
|
148
148
|
|
|
149
149
|
OptionParser.new do |opts|
|
|
150
|
-
opts.
|
|
150
|
+
opts.program_name = "minitest"
|
|
151
151
|
opts.version = Minitest::VERSION
|
|
152
152
|
|
|
153
|
+
opts.banner = [
|
|
154
|
+
"Usage: rake test [A=options] (see Minitest::TestTask for more options)",
|
|
155
|
+
"minitest [paths] [options] (with minitest-sprint gem)",
|
|
156
|
+
"ruby path/to/test.rb [options]\n\n",
|
|
157
|
+
].join "\n or: "
|
|
158
|
+
|
|
153
159
|
opts.on "-h", "--help", "Display this help." do
|
|
154
160
|
puts opts
|
|
155
161
|
exit
|
|
156
162
|
end
|
|
157
163
|
|
|
158
|
-
opts.on "--no-plugins", "Bypass minitest plugin auto-loading (or
|
|
164
|
+
opts.on "--no-plugins", "Bypass minitest plugin auto-loading (or env: MT_NO_PLUGINS=1)."
|
|
159
165
|
|
|
160
|
-
desc = "Sets random seed. Also via env
|
|
166
|
+
desc = "Sets random seed. Also via env, eg: SEED=42"
|
|
161
167
|
opts.on "-s", "--seed SEED", Integer, desc do |m|
|
|
162
|
-
options[:seed] = m
|
|
168
|
+
options[:seed] = m
|
|
163
169
|
end
|
|
164
170
|
|
|
165
|
-
opts.on "-v", "--verbose", "Verbose.
|
|
171
|
+
opts.on "-v", "--verbose", "Verbose. Print each name as they run." do
|
|
166
172
|
options[:verbose] = true
|
|
167
173
|
end
|
|
168
174
|
|
|
169
|
-
opts.on "-q", "--quiet", "Quiet. Show no
|
|
175
|
+
opts.on "-q", "--quiet", "Quiet. Show no dots while processing files." do
|
|
170
176
|
options[:quiet] = true
|
|
171
177
|
end
|
|
172
178
|
|
|
@@ -174,7 +180,7 @@ module Minitest
|
|
|
174
180
|
options[:show_skips] = true
|
|
175
181
|
end
|
|
176
182
|
|
|
177
|
-
opts.on "-n", "--name PATTERN", "
|
|
183
|
+
opts.on "-n", "--name PATTERN", "Include /regexp/ or string for run." do |a|
|
|
178
184
|
options[:filter] = a
|
|
179
185
|
end
|
|
180
186
|
|
|
@@ -182,21 +188,28 @@ module Minitest
|
|
|
182
188
|
options[:exclude] = a
|
|
183
189
|
end
|
|
184
190
|
|
|
191
|
+
# omg wtf
|
|
192
|
+
def opts.short_alias(from, to) = top.short[to] = top.short[from]
|
|
193
|
+
def opts.long_alias(from, to) = top.long[to] = top.long[from]
|
|
194
|
+
|
|
195
|
+
# these will work but won't show up in --help output:
|
|
196
|
+
opts.long_alias "name", "include"
|
|
197
|
+
opts.short_alias "n", "i"
|
|
198
|
+
opts.short_alias "e", "x"
|
|
199
|
+
|
|
185
200
|
opts.on "-S", "--skip CODES", String, "Skip reporting of certain types of results (eg E)." do |s|
|
|
186
201
|
options[:skip] = s.chars.to_a
|
|
187
202
|
end
|
|
188
203
|
|
|
189
|
-
ruby27plus = ::Warning.respond_to? :[]=
|
|
190
|
-
|
|
191
204
|
opts.on "-W[error]", String, "Turn Ruby warnings into errors" do |s|
|
|
192
205
|
options[:Werror] = true
|
|
193
206
|
case s
|
|
194
207
|
when "error", "all", nil then
|
|
195
208
|
require "minitest/error_on_warning"
|
|
196
209
|
$VERBOSE = true
|
|
197
|
-
::Warning[:deprecated] = true
|
|
210
|
+
::Warning[:deprecated] = true
|
|
198
211
|
else
|
|
199
|
-
::Warning[s.to_sym] = true
|
|
212
|
+
::Warning[s.to_sym] = true # check validity of category
|
|
200
213
|
end
|
|
201
214
|
end
|
|
202
215
|
|
|
@@ -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
|
-
|
|
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.
|
|
@@ -1280,12 +1279,16 @@ class TestMinitestAssertions < Minitest::Test
|
|
|
1280
1279
|
end
|
|
1281
1280
|
|
|
1282
1281
|
def test_refute_in_epsilon_triggered
|
|
1283
|
-
assert_triggered "Expected |10000 -
|
|
1284
|
-
@tc.refute_in_epsilon 10_000,
|
|
1282
|
+
assert_triggered "Expected |10000 - 9991| (9) to not be <= 9.991." do
|
|
1283
|
+
@tc.refute_in_epsilon 10_000, 9991
|
|
1285
1284
|
flunk
|
|
1286
1285
|
end
|
|
1287
1286
|
end
|
|
1288
1287
|
|
|
1288
|
+
def test_refute_in_epsilon_minimum
|
|
1289
|
+
@tc.refute_in_epsilon 10_000, 9990
|
|
1290
|
+
end
|
|
1291
|
+
|
|
1289
1292
|
def test_refute_includes
|
|
1290
1293
|
@assertion_count = 2
|
|
1291
1294
|
|
|
@@ -368,11 +368,7 @@ class TestMinitestMock < Minitest::Test
|
|
|
368
368
|
end
|
|
369
369
|
|
|
370
370
|
assert_silent do
|
|
371
|
-
|
|
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
|
|
405
|
-
assert_match(/missing keyword:
|
|
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
|
-
|
|
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
|
|
@@ -939,6 +939,16 @@ class TestMeta < MetaMetaMetaTestCase
|
|
|
939
939
|
assert_equal "ExampleB::random_method::addl_context", spec_c.name
|
|
940
940
|
end
|
|
941
941
|
|
|
942
|
+
def test_inspect
|
|
943
|
+
spec_a = describe ExampleA do; end
|
|
944
|
+
spec_b = describe ExampleB, :random_method do; end
|
|
945
|
+
spec_c = describe ExampleB, :random_method, :addl_context do; end
|
|
946
|
+
|
|
947
|
+
assert_equal "ExampleA", spec_a.inspect
|
|
948
|
+
assert_equal "ExampleB::random_method", spec_b.inspect
|
|
949
|
+
assert_equal "ExampleB::random_method::addl_context", spec_c.inspect
|
|
950
|
+
end
|
|
951
|
+
|
|
942
952
|
def test_name2
|
|
943
953
|
assert_equal "NamedExampleA", NamedExampleA.name
|
|
944
954
|
assert_equal "NamedExampleB", NamedExampleB.name
|
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.
|
|
4
|
+
version: 5.26.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ryan Davis
|
|
@@ -175,7 +175,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
175
175
|
requirements:
|
|
176
176
|
- - ">="
|
|
177
177
|
- !ruby/object:Gem::Version
|
|
178
|
-
version: '
|
|
178
|
+
version: '3.1'
|
|
179
179
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
180
180
|
requirements:
|
|
181
181
|
- - ">="
|
metadata.gz.sig
CHANGED
|
Binary file
|