minitest 5.16.3 → 5.17.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/History.rdoc +12 -0
- data/README.rdoc +14 -17
- data/lib/minitest/mock.rb +5 -1
- data/lib/minitest/spec.rb +6 -0
- data/lib/minitest/test.rb +9 -5
- data/lib/minitest/test_task.rb +3 -3
- data/lib/minitest.rb +2 -10
- data/test/minitest/test_minitest_mock.rb +9 -2
- data/test/minitest/test_minitest_spec.rb +35 -0
- data.tar.gz.sig +0 -0
- metadata +12 -12
- 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: 76379897c6c77174044638d17a95f50b1b2fddbfde053759d864d8b9b419984b
|
4
|
+
data.tar.gz: 7cdedb3e76825894a5577f2c639c541402e1955b1166221530e2937b6c605b81
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5bc0b4b036c2e07d3db6ace79c1d0e51d2aa5cac74a26174ec822f1f987882bffc0165650c86f168ee38b31e9f07d825730b20a1f13b704fc395a9a88a4d9060
|
7
|
+
data.tar.gz: e9bdf26bc5a327b72b7a1dbdf701f6cef70561b634a258f932c511f26e7f2886597a05cc4a964749ef16e32529ab6a0cb6d11601f2954c3830444d34c3fcb23b
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/History.rdoc
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
=== 5.17.0 / 2022-12-31
|
2
|
+
|
3
|
+
* 1 minor enhancement:
|
4
|
+
|
5
|
+
* Refactor setup hooks into a SETUP_METHODS constant. (MSP-Greg)
|
6
|
+
|
7
|
+
* 3 bug fixes:
|
8
|
+
|
9
|
+
* Fix kwargs for Mock calls to delegator. (blowmage)
|
10
|
+
* Fix kwargs for expectations. (bobmazanec, blowmage)
|
11
|
+
* Remove check for .b method. (tenderlove)
|
12
|
+
|
1
13
|
=== 5.16.3 / 2022-08-17
|
2
14
|
|
3
15
|
* 2 bug fixes:
|
data/README.rdoc
CHANGED
@@ -407,37 +407,34 @@ Using our example above, here is how we might implement MyCI:
|
|
407
407
|
|
408
408
|
Minitest is a dependency of rails, which until fairly recently had an
|
409
409
|
overzealous backwards compatibility policy. As such, I'm stuck
|
410
|
-
supporting versions of ruby that are long past EOL.
|
411
|
-
|
412
|
-
|
410
|
+
supporting versions of ruby that are long past EOL. Hopefully I'll be
|
411
|
+
able to support only current versions of ruby sometime in the near
|
412
|
+
future.
|
413
413
|
|
414
|
-
(As of
|
414
|
+
(As of 2022-11-29)
|
415
415
|
|
416
416
|
Current versions of rails: (https://endoflife.date/rails)
|
417
417
|
|
418
|
-
| rails | min ruby | rec ruby | minitest | status |
|
419
|
-
|
420
|
-
| 7.0 | >= 2.7 | 3.
|
421
|
-
| 6.1 | >= 2.5 | 3.0 | >= 5.1 |
|
422
|
-
| 6.0 | >= 2.5 | 2.6 | >= 5.1 | Security |
|
423
|
-
| 5.2 | >= 2.2.2 | 2.5 | ~> 5.1 |
|
418
|
+
| rails | min ruby | rec ruby | minitest | status | EOL Date |
|
419
|
+
|-------+----------+----------+----------+----------+------------|
|
420
|
+
| 7.0 | >= 2.7 | 3.1 | >= 5.1 | Current | 2025-06-01?|
|
421
|
+
| 6.1 | >= 2.5 | 3.0 | >= 5.1 | Maint | 2024-06-01?|
|
422
|
+
| 6.0 | >= 2.5 | 2.6 | >= 5.1 | Security | 2023-06-01 |
|
423
|
+
| 5.2 | >= 2.2.2 | 2.5 | ~> 5.1 | EOL | 2022-06-01 |
|
424
424
|
|
425
425
|
Current versions of ruby: (https://endoflife.date/ruby)
|
426
426
|
|
427
427
|
| ruby | Status | EOL Date |
|
428
428
|
|------+---------+------------|
|
429
|
-
| 3.
|
430
|
-
|
|
431
|
-
| 2.
|
429
|
+
| 3.1 | Current | 2025-12-25 |
|
430
|
+
| 3.0 | Maint | 2024-03-31 |
|
431
|
+
| 2.7 | Maint* | 2023-03-31 |
|
432
|
+
| 2.6 | EOL | 2022-03-31 |
|
432
433
|
| 2.5 | EOL | 2021-03-31 |
|
433
|
-
| 2.4 | EOL | 2020-03-31 |
|
434
|
-
| 2.3 | EOL | 2019-03-31 |
|
435
|
-
| 2.2 | EOL | 2018-03-31 |
|
436
434
|
|
437
435
|
See also:
|
438
436
|
|
439
437
|
* https://www.fastruby.io/blog/ruby/rails/versions/compatibility-table.html
|
440
|
-
* https://jamesjeffersconsulting.com/ruby-rails-version-matrix/
|
441
438
|
|
442
439
|
=== How to test SimpleDelegates?
|
443
440
|
|
data/lib/minitest/mock.rb
CHANGED
@@ -150,7 +150,11 @@ module Minitest # :nodoc:
|
|
150
150
|
def method_missing sym, *args, **kwargs, &block # :nodoc:
|
151
151
|
unless @expected_calls.key?(sym) then
|
152
152
|
if @delegator && @delegator.respond_to?(sym)
|
153
|
-
|
153
|
+
if kwargs.empty? then # FIX: drop this after 2.7 dead
|
154
|
+
return @delegator.public_send(sym, *args, &block)
|
155
|
+
else
|
156
|
+
return @delegator.public_send(sym, *args, **kwargs, &block)
|
157
|
+
end
|
154
158
|
else
|
155
159
|
raise NoMethodError, "unmocked method %p, expected one of %p" %
|
156
160
|
[sym, @expected_calls.keys.sort_by(&:to_s)]
|
data/lib/minitest/spec.rb
CHANGED
@@ -6,6 +6,10 @@ class Module # :nodoc:
|
|
6
6
|
dont_flip = false if block
|
7
7
|
target_obj = block ? '_{obj.method}' : '_(obj)'
|
8
8
|
|
9
|
+
# https://eregon.me/blog/2021/02/13/correct-delegation-in-ruby-2-27-3.html
|
10
|
+
# Drop this when we can drop ruby 2.6 (aka after rails 6.1 EOL, ~2024-06)
|
11
|
+
kw_extra = "ruby2_keywords %p" % [new_name] if respond_to?(:ruby2_keywords, true)
|
12
|
+
|
9
13
|
# warn "%-22p -> %p %p" % [meth, new_name, dont_flip]
|
10
14
|
self.class_eval <<-EOM, __FILE__, __LINE__ + 1
|
11
15
|
def #{new_name} *args
|
@@ -14,6 +18,7 @@ class Module # :nodoc:
|
|
14
18
|
Kernel.warn "DEPRECATED: global use of #{new_name} from #\{where}. Use #{target_obj}.#{new_name} instead. This will fail in Minitest 6."
|
15
19
|
Minitest::Expectation.new(self, Minitest::Spec.current).#{new_name}(*args)
|
16
20
|
end
|
21
|
+
#{kw_extra}
|
17
22
|
EOM
|
18
23
|
|
19
24
|
Minitest::Expectation.class_eval <<-EOM, __FILE__, __LINE__ + 1
|
@@ -28,6 +33,7 @@ class Module # :nodoc:
|
|
28
33
|
ctx.#{meth}(args.first, target, *args[1..-1])
|
29
34
|
end
|
30
35
|
end
|
36
|
+
#{kw_extra}
|
31
37
|
EOM
|
32
38
|
end
|
33
39
|
end
|
data/lib/minitest/test.rb
CHANGED
@@ -18,6 +18,10 @@ module Minitest
|
|
18
18
|
|
19
19
|
PASSTHROUGH_EXCEPTIONS = [NoMemoryError, SignalException, SystemExit] # :nodoc:
|
20
20
|
|
21
|
+
SETUP_METHODS = %w[ before_setup setup after_setup ] # :nodoc:
|
22
|
+
|
23
|
+
TEARDOWN_METHODS = %w[ before_teardown teardown after_teardown ] # :nodoc:
|
24
|
+
|
21
25
|
# :stopdoc:
|
22
26
|
class << self; attr_accessor :io_lock; end
|
23
27
|
self.io_lock = Mutex.new
|
@@ -84,8 +88,6 @@ module Minitest
|
|
84
88
|
:random
|
85
89
|
end
|
86
90
|
|
87
|
-
TEARDOWN_METHODS = %w[ before_teardown teardown after_teardown ] # :nodoc:
|
88
|
-
|
89
91
|
##
|
90
92
|
# Runs a single test with setup/teardown hooks.
|
91
93
|
|
@@ -93,7 +95,9 @@ module Minitest
|
|
93
95
|
with_info_handler do
|
94
96
|
time_it do
|
95
97
|
capture_exceptions do
|
96
|
-
|
98
|
+
SETUP_METHODS.each do |hook|
|
99
|
+
self.send hook
|
100
|
+
end
|
97
101
|
|
98
102
|
self.send self.name
|
99
103
|
end
|
@@ -208,7 +212,7 @@ module Minitest
|
|
208
212
|
neuter_exception e
|
209
213
|
end
|
210
214
|
|
211
|
-
def neuter_exception e
|
215
|
+
def neuter_exception e # :nodoc:
|
212
216
|
bt = e.backtrace
|
213
217
|
msg = e.message.dup
|
214
218
|
|
@@ -219,7 +223,7 @@ module Minitest
|
|
219
223
|
new_exception RuntimeError, msg, bt, true # but if this raises, we die
|
220
224
|
end
|
221
225
|
|
222
|
-
def new_exception klass, msg, bt, kill = false
|
226
|
+
def new_exception klass, msg, bt, kill = false # :nodoc:
|
223
227
|
ne = klass.new msg
|
224
228
|
ne.set_backtrace bt
|
225
229
|
|
data/lib/minitest/test_task.rb
CHANGED
@@ -277,8 +277,8 @@ module Minitest # :nodoc:
|
|
277
277
|
end
|
278
278
|
end
|
279
279
|
|
280
|
-
class Work < Queue
|
281
|
-
def initialize jobs = []
|
280
|
+
class Work < Queue # :nodoc:
|
281
|
+
def initialize jobs = [] # :nodoc:
|
282
282
|
super()
|
283
283
|
|
284
284
|
jobs.each do |job|
|
@@ -289,7 +289,7 @@ class Work < Queue
|
|
289
289
|
end
|
290
290
|
end
|
291
291
|
|
292
|
-
class Integer
|
292
|
+
class Integer # :nodoc:
|
293
293
|
def threads_do(jobs) # :nodoc:
|
294
294
|
require "thread"
|
295
295
|
q = Work.new jobs
|
data/lib/minitest.rb
CHANGED
@@ -9,7 +9,7 @@ require "etc"
|
|
9
9
|
# :include: README.rdoc
|
10
10
|
|
11
11
|
module Minitest
|
12
|
-
VERSION = "5.
|
12
|
+
VERSION = "5.17.0" # :nodoc:
|
13
13
|
|
14
14
|
@@installed_at_exit ||= false
|
15
15
|
@@after_run = []
|
@@ -823,7 +823,7 @@ module Minitest
|
|
823
823
|
end
|
824
824
|
|
825
825
|
def to_s # :nodoc:
|
826
|
-
aggregated_results(StringIO.new(
|
826
|
+
aggregated_results(StringIO.new(''.b)).string
|
827
827
|
end
|
828
828
|
|
829
829
|
def summary # :nodoc:
|
@@ -836,14 +836,6 @@ module Minitest
|
|
836
836
|
"%d runs, %d assertions, %d failures, %d errors, %d skips%s" %
|
837
837
|
[count, assertions, failures, errors, skips, extra]
|
838
838
|
end
|
839
|
-
|
840
|
-
private
|
841
|
-
|
842
|
-
if '<3'.respond_to? :b
|
843
|
-
def binary_string; ''.b; end
|
844
|
-
else
|
845
|
-
def binary_string; ''.force_encoding(Encoding::ASCII_8BIT); end
|
846
|
-
end
|
847
839
|
end
|
848
840
|
|
849
841
|
##
|
@@ -9,8 +9,6 @@ ensure
|
|
9
9
|
end
|
10
10
|
|
11
11
|
class TestMinitestMock < Minitest::Test
|
12
|
-
parallelize_me!
|
13
|
-
|
14
12
|
def setup
|
15
13
|
@mock = Minitest::Mock.new.expect(:foo, nil)
|
16
14
|
@mock.expect(:meaning_of_life, 42)
|
@@ -260,6 +258,15 @@ class TestMinitestMock < Minitest::Test
|
|
260
258
|
assert_equal exp, e.message
|
261
259
|
end
|
262
260
|
|
261
|
+
def test_delegator_calls_are_propagated
|
262
|
+
delegator = Object.new
|
263
|
+
mock = Minitest::Mock.new delegator
|
264
|
+
|
265
|
+
refute delegator.nil?
|
266
|
+
refute mock.nil?
|
267
|
+
assert_mock mock
|
268
|
+
end
|
269
|
+
|
263
270
|
def test_handles_kwargs_in_error_message
|
264
271
|
mock = Minitest::Mock.new
|
265
272
|
|
@@ -1068,3 +1068,38 @@ class ValueMonadTest < Minitest::Test
|
|
1068
1068
|
assert_equal "c", struct.expect
|
1069
1069
|
end
|
1070
1070
|
end
|
1071
|
+
|
1072
|
+
describe Minitest::Spec, :infect_an_assertion do
|
1073
|
+
class << self
|
1074
|
+
attr_accessor :infect_mock
|
1075
|
+
end
|
1076
|
+
|
1077
|
+
def assert_infects exp, act, msg = nil, foo: nil, bar: nil
|
1078
|
+
self.class.infect_mock.assert_infects exp, act, msg, foo: foo, bar: bar
|
1079
|
+
end
|
1080
|
+
|
1081
|
+
infect_an_assertion :assert_infects, :must_infect
|
1082
|
+
infect_an_assertion :assert_infects, :must_infect_without_flipping, :dont_flip
|
1083
|
+
|
1084
|
+
it "infects assertions with kwargs" do
|
1085
|
+
mock = Minitest::Mock.new
|
1086
|
+
mock.expect :assert_infects, true, [:exp, :act, nil], foo: :foo, bar: :bar
|
1087
|
+
|
1088
|
+
self.class.infect_mock = mock
|
1089
|
+
|
1090
|
+
_(:act).must_infect :exp, foo: :foo, bar: :bar
|
1091
|
+
|
1092
|
+
assert_mock mock
|
1093
|
+
end
|
1094
|
+
|
1095
|
+
it "infects assertions with kwargs (dont_flip)" do
|
1096
|
+
mock = Minitest::Mock.new
|
1097
|
+
mock.expect :assert_infects, true, [:act, :exp, nil], foo: :foo, bar: :bar
|
1098
|
+
|
1099
|
+
self.class.infect_mock = mock
|
1100
|
+
|
1101
|
+
_(:act).must_infect_without_flipping :exp, foo: :foo, bar: :bar
|
1102
|
+
|
1103
|
+
assert_mock mock
|
1104
|
+
end
|
1105
|
+
end
|
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.
|
4
|
+
version: 5.17.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Davis
|
@@ -10,9 +10,9 @@ bindir: bin
|
|
10
10
|
cert_chain:
|
11
11
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
|
-
|
13
|
+
MIIDPjCCAiagAwIBAgIBBzANBgkqhkiG9w0BAQsFADBFMRMwEQYDVQQDDApyeWFu
|
14
14
|
ZC1ydWJ5MRkwFwYKCZImiZPyLGQBGRYJemVuc3BpZGVyMRMwEQYKCZImiZPyLGQB
|
15
|
-
|
15
|
+
GRYDY29tMB4XDTIzMDEwMTA3NTExN1oXDTI0MDEwMTA3NTExN1owRTETMBEGA1UE
|
16
16
|
AwwKcnlhbmQtcnVieTEZMBcGCgmSJomT8ixkARkWCXplbnNwaWRlcjETMBEGCgmS
|
17
17
|
JomT8ixkARkWA2NvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALda
|
18
18
|
b9DCgK+627gPJkB6XfjZ1itoOQvpqH1EXScSaba9/S2VF22VYQbXU1xQXL/WzCkx
|
@@ -22,14 +22,14 @@ cert_chain:
|
|
22
22
|
qhtV7HJxNKuPj/JFH0D2cswvzznE/a5FOYO68g+YCuFi5L8wZuuM8zzdwjrWHqSV
|
23
23
|
gBEfoTEGr7Zii72cx+sCAwEAAaM5MDcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAw
|
24
24
|
HQYDVR0OBBYEFEfFe9md/r/tj/Wmwpy+MI8d9k/hMA0GCSqGSIb3DQEBCwUAA4IB
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
25
|
+
AQAkg3y+PBnBAPWdxxITm5sPHqdWQgSyCpRA20o4LTuWr8BWhSXBkfQNa7cY6fOn
|
26
|
+
xyM34VPzBFbExv6XOGDfOMFBVaYTHuN9peC/5/umL7kLl+nflXzL2QA7K6LYj5Bg
|
27
|
+
sM574Onr0dZDM6Vn69bzQ7rBIFDfK/OhlPzqKZad4nsdcsVH8ODCiT+ATMIZyz5K
|
28
|
+
WCnNtqlyiWXI8tdTpahDgcUwfcN/oN7v4K8iU5IbLJX6HQ5DKgmKjfb6XyMth16k
|
29
|
+
ROfWo9Uyp8ba/j9eVG14KkYRaLydAY1MNQk2yd3R5CGfeOpD1kttxjoypoUJ2dOG
|
30
|
+
nsNBRuQJ1UfiCG97a6DNm+Fr
|
31
31
|
-----END CERTIFICATE-----
|
32
|
-
date:
|
32
|
+
date: 2023-01-01 00:00:00.000000000 Z
|
33
33
|
dependencies:
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
35
|
name: rdoc
|
@@ -57,14 +57,14 @@ dependencies:
|
|
57
57
|
requirements:
|
58
58
|
- - "~>"
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version: '
|
60
|
+
version: '4.0'
|
61
61
|
type: :development
|
62
62
|
prerelease: false
|
63
63
|
version_requirements: !ruby/object:Gem::Requirement
|
64
64
|
requirements:
|
65
65
|
- - "~>"
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version: '
|
67
|
+
version: '4.0'
|
68
68
|
description: |-
|
69
69
|
minitest provides a complete suite of testing facilities supporting
|
70
70
|
TDD, BDD, mocking, and benchmarking.
|
metadata.gz.sig
CHANGED
Binary file
|