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 +4 -4
- checksums.yaml.gz.sig +4 -2
- data/History.rdoc +51 -0
- data/README.rdoc +25 -15
- data/Rakefile +18 -2
- data/design_rationale.rb +21 -19
- data/lib/hoe/minitest.rb +2 -1
- data/lib/minitest/assertions.rb +21 -26
- data/lib/minitest/autorun.rb +4 -4
- data/lib/minitest/benchmark.rb +2 -2
- data/lib/minitest/expectations.rb +2 -2
- data/lib/minitest/hell.rb +1 -1
- data/lib/minitest/manual_plugins.rb +1 -1
- data/lib/minitest/mock.rb +5 -25
- data/lib/minitest/parallel.rb +2 -0
- data/lib/minitest/pride.rb +1 -1
- data/lib/minitest/pride_plugin.rb +1 -1
- data/lib/minitest/spec.rb +9 -6
- data/lib/minitest/test.rb +5 -4
- data/lib/minitest/test_task.rb +28 -11
- data/lib/minitest/unit.rb +1 -1
- data/lib/minitest.rb +48 -33
- data/test/minitest/test_minitest_assertions.rb +19 -62
- data/test/minitest/test_minitest_mock.rb +5 -10
- data/test/minitest/test_minitest_reporter.rb +6 -5
- data/test/minitest/test_minitest_spec.rb +23 -27
- data/test/minitest/test_minitest_test.rb +20 -2
- data.tar.gz.sig +0 -0
- metadata +32 -22
- 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: f9144898bc998f49d23688386cb435165b7ba6fadf83acc47f8120992d2799c6
|
|
4
|
+
data.tar.gz: f90178ecc10c76e8d0cea4c2206972b3bbb899f552c53f1b22743e00d9898a02
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a157620a20602d17c8aaf088cc9c709401d7fd3507569fceb85d358c5519596fdb2bd71ef8b1b597942ba9ba5ef9b0af1530fb97a47fac28add36600516d2edc
|
|
7
|
+
data.tar.gz: 17c0fdb228c63bda818fbc4009c30c88138df74e325e087050843bef8128ea54afade9de4c0e5af6d5f734ad114d34dd97e4eed2ac4e577662144ad8c49f261e
|
checksums.yaml.gz.sig
CHANGED
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
|
|
2
|
+
��ި�f5e4|���8%8V�:��]X�o���q
|
|
3
|
+
��uץ6 ��#�()��u��N������<�ƅ�v
|
|
4
|
+
�������75��NY���x�z@�~�9�� {��e�\���E�N��jp�4�2ovX�l1��f�k�����Ru��qvO�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://
|
|
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
|
-
|
|
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
|
-
|
|
|
422
|
-
|
|
|
423
|
-
|
|
|
424
|
-
|
|
|
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
|
|
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.
|
|
436
|
-
| 3.
|
|
437
|
-
| 3.
|
|
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 |
|
|
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
|
|
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
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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
|
-
|
|
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
|
-
|
|
52
|
+
_(2).must_equal 2
|
|
51
53
|
end
|
|
52
54
|
end
|
data/lib/hoe/minitest.rb
CHANGED
data/lib/minitest/assertions.rb
CHANGED
|
@@ -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.
|
|
65
|
+
Tempfile.create "expect" do |a|
|
|
66
66
|
a.puts expect
|
|
67
67
|
a.flush
|
|
68
68
|
|
|
69
|
-
Tempfile.
|
|
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
|
|
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
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
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.
|
|
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
|
|
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
|
|
696
|
-
refute_in_delta
|
|
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
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
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
|
##
|
data/lib/minitest/autorun.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
data/lib/minitest/benchmark.rb
CHANGED
|
@@ -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#
|
|
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#
|
|
296
|
+
# See Minitest::Assertions#refute_pattern
|
|
297
297
|
#
|
|
298
298
|
# _ { ... }.wont_pattern_match [...]
|
|
299
299
|
#
|
data/lib/minitest/hell.rb
CHANGED
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/parallel.rb
CHANGED
data/lib/minitest/pride.rb
CHANGED
data/lib/minitest/spec.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
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
|
-
|
|
289
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
238
|
+
require_relative "unit" if ENV["MT_COMPAT"] # compatibility layer only
|
data/lib/minitest/test_task.rb
CHANGED
|
@@ -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
|
|
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
|
-
#
|
|
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
|
|
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
|
-
|
|
14
|
+
require_relative "../minitest"
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
MiniTest = Minitest unless defined?(MiniTest)
|