minitest 5.12.0 → 5.22.2
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 +262 -5
- data/Manifest.txt +3 -0
- data/README.rdoc +90 -17
- data/Rakefile +5 -16
- data/lib/hoe/minitest.rb +0 -4
- data/lib/minitest/assertions.rb +171 -37
- data/lib/minitest/benchmark.rb +7 -7
- data/lib/minitest/compress.rb +94 -0
- data/lib/minitest/expectations.rb +72 -35
- data/lib/minitest/mock.rb +123 -34
- data/lib/minitest/pride_plugin.rb +1 -1
- data/lib/minitest/spec.rb +24 -10
- data/lib/minitest/test.rb +44 -16
- data/lib/minitest/test_task.rb +301 -0
- data/lib/minitest/unit.rb +5 -8
- data/lib/minitest.rb +245 -70
- data/test/minitest/metametameta.rb +45 -11
- data/test/minitest/test_minitest_assertions.rb +357 -29
- data/test/minitest/test_minitest_benchmark.rb +2 -2
- data/test/minitest/test_minitest_mock.rb +287 -15
- data/test/minitest/test_minitest_reporter.rb +158 -17
- data/test/minitest/test_minitest_spec.rb +184 -59
- data/test/minitest/test_minitest_test.rb +362 -42
- data/test/minitest/test_minitest_test_task.rb +46 -0
- data.tar.gz.sig +2 -2
- metadata +28 -19
- 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: 24c5445e518a9b867eabce480e1d5c176c93fc6806eaed987200961e56443ec0
|
4
|
+
data.tar.gz: 2b1c37793c825e1b437d30a899411a2d71e924ab250c23d348f71ca1dbd68df2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc52b553200c232e0493953439fd935ee6cac3e46c45e121c81c2bc0046a5afd44caf8df980273fd46bf9ac81d38f1349f3a76a9ce9f59afff0e0e2316ea1a45
|
7
|
+
data.tar.gz: f98fcfb53d73e1d134d16b376aba3d78ef90d27024c18c48a5e0b153cc55225afc38c2c166e92d9282ffab713654843f82c9fa8a20332a16cc7308c9e1e4a140
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/History.rdoc
CHANGED
@@ -1,3 +1,261 @@
|
|
1
|
+
=== 5.22.2 / 2024-02-07
|
2
|
+
|
3
|
+
* 1 bug fix:
|
4
|
+
|
5
|
+
* Third time's a charm? Remember: 'ensure' is almost always the
|
6
|
+
wrong way to go (for results... it's great for cleaning up).
|
7
|
+
|
8
|
+
=== 5.22.1 / 2024-02-06
|
9
|
+
|
10
|
+
* 1 bug fix:
|
11
|
+
|
12
|
+
* Don't exit non-zero if no tests ran and no filter (aka, the test file is empty).
|
13
|
+
(I'm starting to think the exit 1 thing for @tenderlove was a mistake...)
|
14
|
+
|
15
|
+
=== 5.22.0 / 2024-02-05
|
16
|
+
|
17
|
+
* 1 minor enhancement:
|
18
|
+
|
19
|
+
* Added "did you mean" output if your --name filter matches nothing. (tenderlove)
|
20
|
+
|
21
|
+
* 2 bug fixes:
|
22
|
+
|
23
|
+
* Big cleanup of test filtering. Much prettier / more functional.
|
24
|
+
* Fix situation where Assertion#location can't find the location. (pftg)
|
25
|
+
|
26
|
+
=== 5.21.2 / 2024-01-17
|
27
|
+
|
28
|
+
* 1 bug fix:
|
29
|
+
|
30
|
+
* Fixed bug in Minitest::Compress#compress formatting w/ nested patterns. Now recurses properly.
|
31
|
+
|
32
|
+
=== 5.21.1 / 2024-01-11
|
33
|
+
|
34
|
+
* 1 bug fix:
|
35
|
+
|
36
|
+
* Rails' default backtrace filter can't currently work with caller_locations, so reverting back to caller.
|
37
|
+
|
38
|
+
=== 5.21.0 / 2024-01-11
|
39
|
+
|
40
|
+
* 10 minor enhancements:
|
41
|
+
|
42
|
+
* Add include_all kw arg to assert_respond_to and refute_respond_to.
|
43
|
+
* Added --quiet flag to skip ProgressReporter (prints the dots). Minor speedup.
|
44
|
+
* Added Minitest::Compress#compress and added it to UnexpectedError.
|
45
|
+
* Added ability to initialize BacktraceFilter w/ custom regexp.
|
46
|
+
* Filter failure backtraces using backtrace_filter before calculating location. (thomasmarshall)
|
47
|
+
* Make BacktraceFilter#filter compatible with locations (still compares strings).
|
48
|
+
* Optimized Assertion#location ~30%.
|
49
|
+
* Output relative paths for all failures/errors/backtraces.
|
50
|
+
* Refactored location information in assertions, now using locations.
|
51
|
+
* Removed thread and mutex_m dependencies. (hsbt, eregon)
|
52
|
+
|
53
|
+
* 2 bug fixes:
|
54
|
+
|
55
|
+
* Drop undocumented bt arg in #skip. Dunno why that ever happened, prolly for testing?
|
56
|
+
* Fix mock to work with ruby debugger enabled. (keithlayne)
|
57
|
+
|
58
|
+
=== 5.20.0 / 2023-09-06
|
59
|
+
|
60
|
+
* 1 minor enhancement:
|
61
|
+
|
62
|
+
* Optionally allow autorun exit hook to remain active in forked child. (casperisfine)
|
63
|
+
|
64
|
+
=== 5.19.0 / 2023-07-26
|
65
|
+
|
66
|
+
* 2 minor enhancements:
|
67
|
+
|
68
|
+
* Add metadata lazy accessor to Runnable / Result. (matteeyah)
|
69
|
+
* Only load minitest/unit (aka ancient MiniTest compatibility layer) if \ENV[\"MT_COMPAT\"]
|
70
|
+
|
71
|
+
* 1 bug fix:
|
72
|
+
|
73
|
+
* Minitest::TestTask enthusiastically added itself to default. (ParadoxV5)
|
74
|
+
|
75
|
+
=== 5.18.1 / 2023-06-16
|
76
|
+
|
77
|
+
* 3 bug fixes:
|
78
|
+
|
79
|
+
* Avoid extra string allocations when filtering tests. (tenderlove)
|
80
|
+
* Only mention deprecated \ENV[\'N\'] if it is an integer string.
|
81
|
+
* Push up test_order to Minitest::Runnable to fix minitest/hell. (koic)
|
82
|
+
|
83
|
+
=== 5.18.0 / 2023-03-04
|
84
|
+
|
85
|
+
* 2 major enhancements:
|
86
|
+
|
87
|
+
* Added assert_pattern & refute_pattern for pattern matching. (flavorjones)
|
88
|
+
* Added matching must_pattern_match & wont_pattern_match to minitest/spec.
|
89
|
+
|
90
|
+
* 1 bug fix:
|
91
|
+
|
92
|
+
* Support the new message format of NameError in Ruby 3.3 (mame)
|
93
|
+
|
94
|
+
=== 5.17.0 / 2022-12-31
|
95
|
+
|
96
|
+
* 1 minor enhancement:
|
97
|
+
|
98
|
+
* Refactor setup hooks into a SETUP_METHODS constant. (MSP-Greg)
|
99
|
+
|
100
|
+
* 3 bug fixes:
|
101
|
+
|
102
|
+
* Fix kwargs for Mock calls to delegator. (blowmage)
|
103
|
+
* Fix kwargs for expectations. (bobmazanec, blowmage)
|
104
|
+
* Remove check for .b method. (tenderlove)
|
105
|
+
|
106
|
+
=== 5.16.3 / 2022-08-17
|
107
|
+
|
108
|
+
* 2 bug fixes:
|
109
|
+
|
110
|
+
* Fixed exception sanitization by removing TypeError restriction on rescue.
|
111
|
+
* Use A instead of deprecated TESTOPTS in rake test:slow. (davidstosik)
|
112
|
+
|
113
|
+
=== 5.16.2 / 2022-07-03
|
114
|
+
|
115
|
+
* 4 bug fixes:
|
116
|
+
|
117
|
+
* Added MT_KWARGS_HACK kludge for stub to deal with ruby 2.7 kwargs nastiness. (tsugimoto)
|
118
|
+
* In #expect, pop Hash class from args if $MT_KWARGS_HACK. (casperisfine)
|
119
|
+
* In above scenario, set expected kwargs (as Objects) based on actual kwargs.
|
120
|
+
* Nuke ivars if exception fails to marshal twice (eg better_errors). (irphilli)
|
121
|
+
|
122
|
+
=== 5.16.1 / 2022-06-20
|
123
|
+
|
124
|
+
* 2 bug fixes:
|
125
|
+
|
126
|
+
* Apparently adding real kwarg support to mocks/stubs broke some code. Fixed.
|
127
|
+
* Use `MT_KWARGS_HACK=1` to activate the kludgy kwargs support w/ caveats.
|
128
|
+
* Clarified some doco wrt the block on #stub.
|
129
|
+
|
130
|
+
=== 5.16.0 / 2022-06-14
|
131
|
+
|
132
|
+
* 2 major enhancements:
|
133
|
+
|
134
|
+
* Added Minitest::TestTask.
|
135
|
+
* Dropping ruby 2.2 - 2.5. 2.6 is DTM soon too.
|
136
|
+
|
137
|
+
* 11 minor enhancements:
|
138
|
+
|
139
|
+
* Added --show-skips option to show skips at end of run but not require --verbose. (MSP-Greg)
|
140
|
+
* Added Minitest.seed, the random seed used by the run.
|
141
|
+
* Calling `srand Minitest.seed` before all shuffles to ensure determinism.
|
142
|
+
* Extended #stub to handle kwargs for both block and call args. (SampsonCrowley)
|
143
|
+
* Extended Mock#__call to display kwargs.
|
144
|
+
* Extended Mock#expect to record kwargs.
|
145
|
+
* Extended Mock#method_missing to take kwargs & compare them against expected.
|
146
|
+
* Mock#method_missing displays better errors on arity mismatch.
|
147
|
+
* Removed minor optimization removing empty suites before run.
|
148
|
+
* Simplified test randomization (test order will change even with fixed seed).
|
149
|
+
* assert_match now returns the MatchData on success. (Nakilon)
|
150
|
+
|
151
|
+
* 3 bug fixes:
|
152
|
+
|
153
|
+
* (Re)Fixed marshalling of exceptions, neutering them in 2 passes.
|
154
|
+
* Fixed more problems with rdoc.
|
155
|
+
* Had to patch up mock and stub to deal with <=2.7 kwargs oddities
|
156
|
+
|
157
|
+
=== 5.15.0 / 2021-12-14
|
158
|
+
|
159
|
+
* 1 major enhancement:
|
160
|
+
|
161
|
+
* assert_throws returns the value returned, if any. (volmer)
|
162
|
+
|
163
|
+
* 3 minor enhancements:
|
164
|
+
|
165
|
+
* Added -S <CODES> option to skip reporting of certain types of output
|
166
|
+
* Enable Ruby deprecation warnings by default. (casperisfine)
|
167
|
+
* Use Etc.nprocessors by default in order to maximize cpu usage. (tonytonyjan)
|
168
|
+
|
169
|
+
* 6 bug fixes:
|
170
|
+
|
171
|
+
* Close then unlink tempfiles on Windows. (nobu)
|
172
|
+
* Fixed #skip_until for windows paths. (MSP-Greg)
|
173
|
+
* Fixed a bunch of tests for jruby and windows. (MSP-Greg)
|
174
|
+
* Fixed marshalling of specs if they error. (tenderlove, jeremyevans, et al)
|
175
|
+
* Updated deprecation message for block expectations. (blowmage)
|
176
|
+
* Use Kernel.warn directly in expectations in case CUT defines their own warn. (firien)
|
177
|
+
|
178
|
+
=== 5.14.4 / 2021-02-23
|
179
|
+
|
180
|
+
* 1 bug fix:
|
181
|
+
|
182
|
+
* Fixed deprecation warning using stub with methods using keyword arguments. (Nakilon)
|
183
|
+
|
184
|
+
=== 5.14.3 / 2021-01-05
|
185
|
+
|
186
|
+
* 1 bug fix:
|
187
|
+
|
188
|
+
* Bumped require_ruby_version to < 4 (trunk = 3.1).
|
189
|
+
|
190
|
+
=== 5.14.2 / 2020-08-31
|
191
|
+
|
192
|
+
* 1 bug fix:
|
193
|
+
|
194
|
+
* Bumped ruby version to include 3.0 (trunk).
|
195
|
+
|
196
|
+
=== 5.14.1 / 2020-05-15
|
197
|
+
|
198
|
+
* 3 minor enhancements:
|
199
|
+
|
200
|
+
* Minitest.filter_backtrace returns original backtrace if filter comes back empty.
|
201
|
+
* Minitest::BacktraceFilter now returns entire backtrace if $MT_DEBUG set in env.
|
202
|
+
* Return true on a successful refute. (jusleg)
|
203
|
+
|
204
|
+
* 1 bug fix:
|
205
|
+
|
206
|
+
* Fixed expectation doco to not use global expectations.
|
207
|
+
|
208
|
+
=== 5.14.0 / 2020-01-11
|
209
|
+
|
210
|
+
* 2 minor enhancements:
|
211
|
+
|
212
|
+
* Block-assertions (eg assert_output) now error if raised inside the block. (casperisfine)
|
213
|
+
* Changed assert_raises to only catch Assertion since that covers Skip and friends.
|
214
|
+
|
215
|
+
* 3 bug fixes:
|
216
|
+
|
217
|
+
* Added example for value wrapper with block to Expectations module. (stomar)
|
218
|
+
* Fixed use of must/wont_be_within_delta on Expectation instance. (stomar)
|
219
|
+
* Renamed UnexpectedError#exception to #error to avoid problems with reraising. (casperisfine)
|
220
|
+
|
221
|
+
=== 5.13.0 / 2019-10-29
|
222
|
+
|
223
|
+
* 9 minor enhancements:
|
224
|
+
|
225
|
+
* Added Minitest::Guard#osx?
|
226
|
+
* Added examples to documentation for assert_raises. (lxxxvi)
|
227
|
+
* Added expectations #path_must_exist and #path_wont_exist. Not thrilled with the names.
|
228
|
+
* Added fail_after(year, month, day, msg) to allow time-bombing after a deadline.
|
229
|
+
* Added skip_until(year, month, day, msg) to allow deferring until a deadline.
|
230
|
+
* Deprecated Minitest::Guard#maglev?
|
231
|
+
* Deprecated Minitest::Guard#rubinius?
|
232
|
+
* Finally added assert_path_exists and refute_path_exists. (deivid-rodriguez)
|
233
|
+
* Refactored and pulled Assertions#things_to_diff out of #diff. (BurdetteLamar)
|
234
|
+
|
235
|
+
* 3 bug fixes:
|
236
|
+
|
237
|
+
* Fix autorun bug that affects fork exit status in tests. (dylanahsmith/jhawthorn)
|
238
|
+
* Improved documentation for _/value/expect, especially for blocks. (svoop)
|
239
|
+
* Support new Proc#to_s format. (ko1)
|
240
|
+
|
241
|
+
=== 5.12.2 / 2019-09-28
|
242
|
+
|
243
|
+
* 1 bug fix:
|
244
|
+
|
245
|
+
* After chatting w/ @y-yagi and others, decided to lower support to include ruby 2.2.
|
246
|
+
|
247
|
+
=== 5.12.1 / 2019-09-28
|
248
|
+
|
249
|
+
* 1 minor enhancement:
|
250
|
+
|
251
|
+
* Added documentation for Reporter classes. (sshaw)
|
252
|
+
|
253
|
+
* 3 bug fixes:
|
254
|
+
|
255
|
+
* Avoid using 'match?' to support older ruby versions. (y-yagi)
|
256
|
+
* Fixed broken link to reference on goodness-of-fit testing. (havenwood)
|
257
|
+
* Update requirements in readme and Rakefile/hoe spec.
|
258
|
+
|
1
259
|
=== 5.12.0 / 2019-09-22
|
2
260
|
|
3
261
|
* 8 minor enhancements:
|
@@ -13,7 +271,7 @@
|
|
13
271
|
|
14
272
|
* 3 bug fixes:
|
15
273
|
|
16
|
-
* Check
|
274
|
+
* Check \option[:filter] klass before match. Fixes 2.6 warning. (y-yagi)
|
17
275
|
* Fixed Assertions#diff from recalculating if set to nil
|
18
276
|
* Fixed spec section of readme to not use deprecated global expectations. (CheezItMan)
|
19
277
|
|
@@ -142,7 +400,7 @@
|
|
142
400
|
* 2 bug fixes:
|
143
401
|
|
144
402
|
* Re-release to refresh gem certificate signing. ugh.
|
145
|
-
* Fixed hoe/minitest to not augment load path if we're actually testing minitest.
|
403
|
+
* Fixed hoe/minitest to not augment load path if we're actually testing minitest.
|
146
404
|
|
147
405
|
=== 5.9.0 / 2016-05-16
|
148
406
|
|
@@ -166,7 +424,7 @@
|
|
166
424
|
* 2 bug fixes:
|
167
425
|
|
168
426
|
* Re-release to refresh gem certificate signing. ugh.
|
169
|
-
* Fixed hoe/minitest to not augment load path if we're actually testing minitest.
|
427
|
+
* Fixed hoe/minitest to not augment load path if we're actually testing minitest.
|
170
428
|
|
171
429
|
=== 5.8.4 / 2016-01-21
|
172
430
|
|
@@ -480,7 +738,7 @@ Minitest 5:
|
|
480
738
|
* Added Minitest::Benchmark.
|
481
739
|
* Your benchmarks need to move to their own subclass.
|
482
740
|
* Benchmarks using the spec DSL have to have "Bench" somewhere in their describe.
|
483
|
-
* MiniTest::Unit.after_tests moved to Minitest.
|
741
|
+
* MiniTest::Unit.after_tests moved to Minitest.after_run
|
484
742
|
* MiniTest::Unit.autorun is now Minitest.autorun. Just require minitest/autorun pls.
|
485
743
|
* Removed ParallelEach#grep since it isn't used anywhere.
|
486
744
|
* Renamed Runnable#__name__ to Runnable#name (but uses @NAME internally).
|
@@ -1326,4 +1584,3 @@ back.
|
|
1326
1584
|
* 1 major enhancement
|
1327
1585
|
|
1328
1586
|
* Birthday!
|
1329
|
-
|
data/Manifest.txt
CHANGED
@@ -9,6 +9,7 @@ lib/minitest.rb
|
|
9
9
|
lib/minitest/assertions.rb
|
10
10
|
lib/minitest/autorun.rb
|
11
11
|
lib/minitest/benchmark.rb
|
12
|
+
lib/minitest/compress.rb
|
12
13
|
lib/minitest/expectations.rb
|
13
14
|
lib/minitest/hell.rb
|
14
15
|
lib/minitest/mock.rb
|
@@ -17,6 +18,7 @@ lib/minitest/pride.rb
|
|
17
18
|
lib/minitest/pride_plugin.rb
|
18
19
|
lib/minitest/spec.rb
|
19
20
|
lib/minitest/test.rb
|
21
|
+
lib/minitest/test_task.rb
|
20
22
|
lib/minitest/unit.rb
|
21
23
|
test/minitest/metametameta.rb
|
22
24
|
test/minitest/test_minitest_assertions.rb
|
@@ -25,3 +27,4 @@ test/minitest/test_minitest_mock.rb
|
|
25
27
|
test/minitest/test_minitest_reporter.rb
|
26
28
|
test/minitest/test_minitest_spec.rb
|
27
29
|
test/minitest/test_minitest_test.rb
|
30
|
+
test/minitest/test_minitest_test_task.rb
|
data/README.rdoc
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
= minitest/{test,spec,mock,benchmark}
|
2
2
|
|
3
|
-
home :: https://github.com/
|
4
|
-
bugs :: https://github.com/
|
5
|
-
rdoc ::
|
3
|
+
home :: https://github.com/minitest/minitest
|
4
|
+
bugs :: https://github.com/minitest/minitest/issues
|
5
|
+
rdoc :: https://docs.seattlerb.org/minitest
|
6
|
+
clog :: https://github.com/minitest/minitest/blob/master/History.rdoc
|
6
7
|
vim :: https://github.com/sunaku/vim-ruby-minitest
|
7
8
|
emacs:: https://github.com/arthurnn/minitest-emacs
|
8
9
|
|
@@ -70,6 +71,7 @@ extract-method refactorings still apply.
|
|
70
71
|
* minitest/mock - a simple and clean mock/stub system.
|
71
72
|
* minitest/benchmark - an awesome way to assert your algorithm's performance.
|
72
73
|
* minitest/pride - show your pride in testing!
|
74
|
+
* minitest/test_task - a full-featured and clean rake task generator.
|
73
75
|
* Incredibly small and fast runner, but no bells and whistles.
|
74
76
|
* Written by squishy human beings. Software can never be perfect. We will all eventually die.
|
75
77
|
|
@@ -186,7 +188,7 @@ Output is tab-delimited to make it easy to paste into a spreadsheet.
|
|
186
188
|
=== Mocks
|
187
189
|
|
188
190
|
Mocks and stubs defined using terminology by Fowler & Meszaros at
|
189
|
-
|
191
|
+
https://www.martinfowler.com/bliki/TestDouble.html:
|
190
192
|
|
191
193
|
"Mocks are pre-programmed with expectations which form a specification
|
192
194
|
of the calls they are expected to receive. They can throw an exception
|
@@ -220,9 +222,9 @@ verification to ensure they got all the calls they were expecting."
|
|
220
222
|
end
|
221
223
|
end
|
222
224
|
|
223
|
-
|
225
|
+
==== Multi-threading and Mocks
|
224
226
|
|
225
|
-
Minitest mocks do not support multi-threading
|
227
|
+
Minitest mocks do not support multi-threading. If it works, fine, if it doesn't
|
226
228
|
you can use regular ruby patterns and facilities like local variables. Here's
|
227
229
|
an example of asserting that code inside a thread is run:
|
228
230
|
|
@@ -237,7 +239,7 @@ an example of asserting that code inside a thread is run:
|
|
237
239
|
=== Stubs
|
238
240
|
|
239
241
|
Mocks and stubs are defined using terminology by Fowler & Meszaros at
|
240
|
-
|
242
|
+
https://www.martinfowler.com/bliki/TestDouble.html:
|
241
243
|
|
242
244
|
"Stubs provide canned answers to calls made during the test".
|
243
245
|
|
@@ -264,9 +266,8 @@ new non-existing method:
|
|
264
266
|
|
265
267
|
=== Running Your Tests
|
266
268
|
|
267
|
-
Ideally, you'll use a rake task to run your tests, either
|
268
|
-
all at once.
|
269
|
-
tests. BUT! You don't have to:
|
269
|
+
Ideally, you'll use a rake task to run your tests (see below), either
|
270
|
+
piecemeal or all at once. BUT! You don't have to:
|
270
271
|
|
271
272
|
% ruby -Ilib:test test/minitest/test_minitest_test.rb
|
272
273
|
Run options: --seed 37685
|
@@ -294,18 +295,45 @@ provided via plugins. To see them, simply run with +--help+:
|
|
294
295
|
-p, --pride Pride. Show your testing pride!
|
295
296
|
-a, --autotest Connect to autotest server.
|
296
297
|
|
298
|
+
=== Rake Tasks
|
299
|
+
|
297
300
|
You can set up a rake task to run all your tests by adding this to your Rakefile:
|
298
301
|
|
299
|
-
require "
|
302
|
+
require "minitest/test_task"
|
303
|
+
|
304
|
+
Minitest::TestTask.create # named test, sensible defaults
|
305
|
+
|
306
|
+
# or more explicitly:
|
300
307
|
|
301
|
-
|
308
|
+
Minitest::TestTask.create(:test) do |t|
|
302
309
|
t.libs << "test"
|
303
310
|
t.libs << "lib"
|
304
|
-
t.
|
311
|
+
t.warning = false
|
312
|
+
t.test_globs = ["test/**/*_test.rb"]
|
305
313
|
end
|
306
314
|
|
307
315
|
task :default => :test
|
308
316
|
|
317
|
+
Each of these will generate 4 tasks:
|
318
|
+
|
319
|
+
rake test :: Run the test suite.
|
320
|
+
rake test:cmd :: Print out the test command.
|
321
|
+
rake test:isolated :: Show which test files fail when run separately.
|
322
|
+
rake test:slow :: Show bottom 25 tests sorted by time.
|
323
|
+
|
324
|
+
=== Rake Task Variables
|
325
|
+
|
326
|
+
There are a bunch of variables you can supply to rake to modify the run.
|
327
|
+
|
328
|
+
MT_LIB_EXTRAS :: Extra libs to dynamically override/inject for custom runs.
|
329
|
+
N :: -n: Tests to run (string or /regexp/).
|
330
|
+
X :: -x: Tests to exclude (string or /regexp/).
|
331
|
+
A :: Any extra arguments. Honors shell quoting.
|
332
|
+
MT_CPU :: How many threads to use for parallel test runs
|
333
|
+
SEED :: -s --seed Sets random seed.
|
334
|
+
TESTOPTS :: Deprecated, same as A
|
335
|
+
FILTER :: Deprecated, same as A
|
336
|
+
|
309
337
|
== Writing Extensions
|
310
338
|
|
311
339
|
To define a plugin, add a file named minitest/XXX_plugin.rb to your
|
@@ -376,6 +404,40 @@ Using our example above, here is how we might implement MyCI:
|
|
376
404
|
|
377
405
|
== FAQ
|
378
406
|
|
407
|
+
=== What versions are compatible with what? Or what versions are supported?
|
408
|
+
|
409
|
+
Minitest is a dependency of rails, which until fairly recently had an
|
410
|
+
overzealous backwards compatibility policy. As such, I'm stuck
|
411
|
+
supporting versions of ruby that are long past EOL. Hopefully I'll be
|
412
|
+
able to support only current versions of ruby sometime in the near
|
413
|
+
future.
|
414
|
+
|
415
|
+
(As of 2023-03-05)
|
416
|
+
|
417
|
+
Current versions of rails: (https://endoflife.date/rails)
|
418
|
+
|
419
|
+
| rails | min ruby | rec ruby | minitest | status | EOL Date |
|
420
|
+
|-------+----------+----------+----------+----------+------------|
|
421
|
+
| 7.0 | >= 2.7 | 3.1 | >= 5.1 | Current | 2025-06-01?|
|
422
|
+
| 6.1 | >= 2.5 | 3.0 | >= 5.1 | Maint | 2024-06-01?|
|
423
|
+
| 6.0 | >= 2.5 | 2.6 | >= 5.1 | Security | 2023-06-01 |
|
424
|
+
| 5.2 | >= 2.2.2 | 2.5 | ~> 5.1 | EOL | 2022-06-01 |
|
425
|
+
|
426
|
+
If you want to look at the requirements for a specific version, run:
|
427
|
+
|
428
|
+
gem spec -r --ruby rails -v 7.0.0
|
429
|
+
|
430
|
+
Current versions of ruby: (https://endoflife.date/ruby)
|
431
|
+
|
432
|
+
| ruby | Status | EOL Date |
|
433
|
+
|------+---------+------------|
|
434
|
+
| 3.2 | Current | 2026-03-31 |
|
435
|
+
| 3.1 | Maint | 2025-03-31 |
|
436
|
+
| 3.0 | Maint | 2024-03-31 |
|
437
|
+
| 2.7 | Security| 2023-03-31 |
|
438
|
+
| 2.6 | EOL | 2022-03-31 |
|
439
|
+
| 2.5 | EOL | 2021-03-31 |
|
440
|
+
|
379
441
|
=== How to test SimpleDelegates?
|
380
442
|
|
381
443
|
The following implementation and test:
|
@@ -481,6 +543,8 @@ able to require minitest and run your tests.
|
|
481
543
|
|
482
544
|
== Developing Minitest:
|
483
545
|
|
546
|
+
Minitest requires {Hoe}[https://rubygems.org/gems/hoe].
|
547
|
+
|
484
548
|
=== Minitest's own tests require UTF-8 external encoding.
|
485
549
|
|
486
550
|
This is a common problem in Windows, where the default external Encoding is
|
@@ -559,6 +623,7 @@ minispec-metadata :: Metadata for describe/it blocks & CLI tag filter.
|
|
559
623
|
E.g. <tt>it "requires JS driver", js: true do</tt> &
|
560
624
|
<tt>ruby test.rb --tag js</tt> runs tests tagged :js.
|
561
625
|
minispec-rails :: Minimal support to use Spec style in Rails 5+.
|
626
|
+
mini-apivore :: for swagger based automated API testing.
|
562
627
|
minitest-around :: Around block for minitest. An alternative to
|
563
628
|
setup/teardown dance.
|
564
629
|
minitest-assert_errors :: Adds Minitest assertions to test for errors raised
|
@@ -575,6 +640,7 @@ minitest-capistrano :: Assertions and expectations for testing
|
|
575
640
|
Capistrano recipes.
|
576
641
|
minitest-capybara :: Capybara matchers support for minitest unit and
|
577
642
|
spec.
|
643
|
+
minitest-cc :: It provides minimal information about code coverage.
|
578
644
|
minitest-chef-handler :: Run Minitest suites as Chef report handlers
|
579
645
|
minitest-ci :: CI reporter plugin for Minitest.
|
580
646
|
minitest-context :: Defines contexts for code reuse in Minitest
|
@@ -601,12 +667,14 @@ minitest-firemock :: Makes your Minitest mocks more resilient.
|
|
601
667
|
minitest-focus :: Focus on one test at a time.
|
602
668
|
minitest-gcstats :: A minitest plugin that adds a report of the top
|
603
669
|
tests by number of objects allocated.
|
670
|
+
minitest-global_expectations:: Support minitest expectation methods for all objects
|
604
671
|
minitest-great_expectations :: Generally useful additions to minitest's
|
605
672
|
assertions and expectations.
|
606
673
|
minitest-growl :: Test notifier for minitest via growl.
|
607
674
|
minitest-happy :: GLOBALLY ACTIVATE MINITEST PRIDE! RAWR!
|
608
675
|
minitest-have_tag :: Adds Minitest assertions to test for the existence of
|
609
676
|
HTML tags, including contents, within a provided string.
|
677
|
+
minitest-heat :: Reporting that builds a heat map of failure locations
|
610
678
|
minitest-hooks :: Around and before_all/after_all/around_all hooks
|
611
679
|
minitest-hyper :: Pretty, single-page HTML reports for your Minitest runs
|
612
680
|
minitest-implicit-subject :: Implicit declaration of the test subject.
|
@@ -671,8 +739,9 @@ minitest-stub-const :: Stub constants for the duration of a block.
|
|
671
739
|
minitest-tags :: Add tags for minitest.
|
672
740
|
minitest-unordered :: Adds a new assertion to minitest for checking the
|
673
741
|
contents of a collection, ignoring element order.
|
674
|
-
minitest-vcr :: Automatic cassette
|
742
|
+
minitest-vcr :: Automatic cassette management with Minitest::Spec
|
675
743
|
and VCR.
|
744
|
+
minitest_log :: Adds structured logging, data explication, and verdicts.
|
676
745
|
minitest_owrapper :: Get tests results as a TestResult object.
|
677
746
|
minitest_should :: Shoulda style syntax for minitest test::unit.
|
678
747
|
minitest_tu_shim :: Bridges between test/unit and minitest.
|
@@ -680,8 +749,13 @@ mongoid-minitest :: Minitest matchers for Mongoid.
|
|
680
749
|
mutant-minitest :: Minitest integration for mutant.
|
681
750
|
pry-rescue :: A pry plugin w/ minitest support. See
|
682
751
|
pry-rescue/minitest.rb.
|
752
|
+
rematch :: Declutter your test files from large hardcoded data
|
753
|
+
and update them automatically when your code changes.
|
683
754
|
rspec2minitest :: Easily translate any RSpec matchers to Minitest
|
684
755
|
assertions and expectations.
|
756
|
+
stubberry :: Multiple stubbing 'berries', sweet and useful
|
757
|
+
stub helpers and assertions. ( stub_must,
|
758
|
+
assert_method_called, stubbing ORM objects by id )
|
685
759
|
|
686
760
|
== Unknown Extensions:
|
687
761
|
|
@@ -707,12 +781,11 @@ Authors... Please send me a pull request with a description of your minitest ext
|
|
707
781
|
|
708
782
|
== Minitest related goods
|
709
783
|
|
710
|
-
* minitest/pride fabric:
|
784
|
+
* minitest/pride fabric: https://www.spoonflower.com/fabric/3928730-again-by-katie_allen
|
711
785
|
|
712
786
|
== REQUIREMENTS:
|
713
787
|
|
714
|
-
* Ruby
|
715
|
-
* NOTE: 1.8 and 1.9 will be dropped in minitest 6+.
|
788
|
+
* Ruby 2.3+. No magic is involved. I hope.
|
716
789
|
|
717
790
|
== INSTALL:
|
718
791
|
|
data/Rakefile
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require "rubygems"
|
4
4
|
require "hoe"
|
5
|
+
$:.unshift "lib" # to pick up lib/minitest/test_task.rb when minitest not installed
|
5
6
|
|
6
7
|
Hoe.plugin :seattlerb
|
7
8
|
Hoe.plugin :rdoc
|
@@ -11,21 +12,7 @@ Hoe.spec "minitest" do
|
|
11
12
|
|
12
13
|
license "MIT"
|
13
14
|
|
14
|
-
|
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 and 1.9 (and maybe 2.0?). If you need to keep using 1.8
|
19
|
-
# or 1.9, you need to pin your dependency to minitest with
|
20
|
-
# something like "~> 5.0".
|
21
|
-
#
|
22
|
-
# Further, minitest 6 will be dropping the following:
|
23
|
-
#
|
24
|
-
# + MiniTest (it's been Minitest for *years*)
|
25
|
-
# + MiniTest::Unit
|
26
|
-
# + MiniTest::Unit::TestCase
|
27
|
-
# + assert_send (unless you argue for it well)
|
28
|
-
# EOM
|
15
|
+
require_ruby_version [">= 2.6", "< 4.0"]
|
29
16
|
end
|
30
17
|
|
31
18
|
desc "Find missing expectations"
|
@@ -35,7 +22,7 @@ task :specs do
|
|
35
22
|
require "minitest/spec"
|
36
23
|
|
37
24
|
pos_prefix, neg_prefix = "must", "wont"
|
38
|
-
skip_re = /^(must|wont)$|wont_(throw)|must_(block|not?_|nothing|raise$)/x
|
25
|
+
skip_re = /^(must|wont)$|wont_(throw)|must_(block|not?_|nothing|send|raise$)/x
|
39
26
|
dont_flip_re = /(must|wont)_(include|respond_to)/
|
40
27
|
|
41
28
|
map = {
|
@@ -46,6 +33,8 @@ task :specs do
|
|
46
33
|
/_includes/ => "_include",
|
47
34
|
/(must|wont)_(.*_of|nil|silent|empty)/ => '\1_be_\2',
|
48
35
|
/must_raises/ => "must_raise",
|
36
|
+
/(must|wont)_predicate/ => '\1_be',
|
37
|
+
/(must|wont)_path_exists/ => 'path_\1_exist',
|
49
38
|
}
|
50
39
|
|
51
40
|
expectations = Minitest::Expectations.public_instance_methods.map(&:to_s)
|
data/lib/hoe/minitest.rb
CHANGED