minitest 5.11.3 → 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 +0 -0
- data/History.rdoc +426 -4
- data/Manifest.txt +6 -0
- data/README.rdoc +119 -20
- data/Rakefile +28 -17
- data/design_rationale.rb +21 -19
- data/lib/hoe/minitest.rb +4 -6
- data/lib/minitest/assertions.rb +257 -100
- data/lib/minitest/autorun.rb +4 -11
- data/lib/minitest/benchmark.rb +15 -18
- data/lib/minitest/compress.rb +94 -0
- data/lib/minitest/error_on_warning.rb +11 -0
- data/lib/minitest/expectations.rb +72 -35
- data/lib/minitest/hell.rb +1 -1
- data/lib/minitest/manual_plugins.rb +16 -0
- data/lib/minitest/mock.rb +131 -44
- data/lib/minitest/parallel.rb +7 -5
- data/lib/minitest/pride.rb +1 -1
- data/lib/minitest/pride_plugin.rb +18 -25
- data/lib/minitest/spec.rb +47 -25
- data/lib/minitest/test.rb +54 -36
- data/lib/minitest/test_task.rb +324 -0
- data/lib/minitest/unit.rb +6 -9
- data/lib/minitest.rb +443 -180
- data/test/minitest/metametameta.rb +65 -17
- data/test/minitest/test_minitest_assertions.rb +1677 -0
- data/test/minitest/test_minitest_benchmark.rb +3 -3
- data/test/minitest/test_minitest_mock.rb +405 -66
- data/test/minitest/test_minitest_reporter.rb +174 -36
- data/test/minitest/test_minitest_spec.rb +368 -196
- data/test/minitest/test_minitest_test.rb +476 -1244
- data/test/minitest/test_minitest_test_task.rb +57 -0
- data.tar.gz.sig +0 -0
- metadata +50 -23
- metadata.gz.sig +0 -0
data/README.rdoc
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
= minitest/{test,spec,mock,benchmark}
|
|
2
2
|
|
|
3
|
-
home :: https://
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
home :: https://minite.st/
|
|
4
|
+
code :: https://github.com/minitest/minitest
|
|
5
|
+
bugs :: https://github.com/minitest/minitest/issues
|
|
6
|
+
rdoc :: https://docs.seattlerb.org/minitest
|
|
7
|
+
clog :: https://github.com/minitest/minitest/blob/master/History.rdoc
|
|
7
8
|
emacs:: https://github.com/arthurnn/minitest-emacs
|
|
9
|
+
vim :: https://github.com/vim-test/vim-test
|
|
8
10
|
|
|
9
11
|
== DESCRIPTION:
|
|
10
12
|
|
|
@@ -70,6 +72,7 @@ extract-method refactorings still apply.
|
|
|
70
72
|
* minitest/mock - a simple and clean mock/stub system.
|
|
71
73
|
* minitest/benchmark - an awesome way to assert your algorithm's performance.
|
|
72
74
|
* minitest/pride - show your pride in testing!
|
|
75
|
+
* minitest/test_task - a full-featured and clean rake task generator.
|
|
73
76
|
* Incredibly small and fast runner, but no bells and whistles.
|
|
74
77
|
* Written by squishy human beings. Software can never be perfect. We will all eventually die.
|
|
75
78
|
|
|
@@ -93,7 +96,9 @@ Given that you'd like to test the following class:
|
|
|
93
96
|
|
|
94
97
|
=== Unit tests
|
|
95
98
|
|
|
96
|
-
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.
|
|
97
102
|
|
|
98
103
|
require "minitest/autorun"
|
|
99
104
|
|
|
@@ -117,6 +122,9 @@ Define your tests as methods beginning with +test_+.
|
|
|
117
122
|
|
|
118
123
|
=== Specs
|
|
119
124
|
|
|
125
|
+
Use {expectations}[/minitest/Minitest/Expectations.html] to check
|
|
126
|
+
results or state. They must be wrapped in a value call (eg +_+).
|
|
127
|
+
|
|
120
128
|
require "minitest/autorun"
|
|
121
129
|
|
|
122
130
|
describe Meme do
|
|
@@ -126,13 +134,13 @@ Define your tests as methods beginning with +test_+.
|
|
|
126
134
|
|
|
127
135
|
describe "when asked about cheeseburgers" do
|
|
128
136
|
it "must respond positively" do
|
|
129
|
-
@meme.i_can_has_cheezburger
|
|
137
|
+
_(@meme.i_can_has_cheezburger?).must_equal "OHAI!"
|
|
130
138
|
end
|
|
131
139
|
end
|
|
132
140
|
|
|
133
141
|
describe "when asked about blending possibilities" do
|
|
134
142
|
it "won't say no" do
|
|
135
|
-
@meme.will_it_blend
|
|
143
|
+
_(@meme.will_it_blend?).wont_match /^no/i
|
|
136
144
|
end
|
|
137
145
|
end
|
|
138
146
|
end
|
|
@@ -144,7 +152,7 @@ For matchers support check out:
|
|
|
144
152
|
|
|
145
153
|
=== Benchmarks
|
|
146
154
|
|
|
147
|
-
Add benchmarks to your tests.
|
|
155
|
+
Add {benchmarks}[/minitest/Minitest/Benchmark.html] to your tests.
|
|
148
156
|
|
|
149
157
|
# optionally run benchmarks, good for CI-only work!
|
|
150
158
|
require "minitest/benchmark" if ENV["BENCH"]
|
|
@@ -186,7 +194,7 @@ Output is tab-delimited to make it easy to paste into a spreadsheet.
|
|
|
186
194
|
=== Mocks
|
|
187
195
|
|
|
188
196
|
Mocks and stubs defined using terminology by Fowler & Meszaros at
|
|
189
|
-
|
|
197
|
+
https://www.martinfowler.com/bliki/TestDouble.html:
|
|
190
198
|
|
|
191
199
|
"Mocks are pre-programmed with expectations which form a specification
|
|
192
200
|
of the calls they are expected to receive. They can throw an exception
|
|
@@ -220,9 +228,9 @@ verification to ensure they got all the calls they were expecting."
|
|
|
220
228
|
end
|
|
221
229
|
end
|
|
222
230
|
|
|
223
|
-
|
|
231
|
+
==== Multi-threading and Mocks
|
|
224
232
|
|
|
225
|
-
Minitest mocks do not support multi-threading
|
|
233
|
+
Minitest mocks do not support multi-threading. If it works, fine, if it doesn't
|
|
226
234
|
you can use regular ruby patterns and facilities like local variables. Here's
|
|
227
235
|
an example of asserting that code inside a thread is run:
|
|
228
236
|
|
|
@@ -237,7 +245,7 @@ an example of asserting that code inside a thread is run:
|
|
|
237
245
|
=== Stubs
|
|
238
246
|
|
|
239
247
|
Mocks and stubs are defined using terminology by Fowler & Meszaros at
|
|
240
|
-
|
|
248
|
+
https://www.martinfowler.com/bliki/TestDouble.html:
|
|
241
249
|
|
|
242
250
|
"Stubs provide canned answers to calls made during the test".
|
|
243
251
|
|
|
@@ -264,9 +272,8 @@ new non-existing method:
|
|
|
264
272
|
|
|
265
273
|
=== Running Your Tests
|
|
266
274
|
|
|
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:
|
|
275
|
+
Ideally, you'll use a rake task to run your tests (see below), either
|
|
276
|
+
piecemeal or all at once. BUT! You don't have to:
|
|
270
277
|
|
|
271
278
|
% ruby -Ilib:test test/minitest/test_minitest_test.rb
|
|
272
279
|
Run options: --seed 37685
|
|
@@ -294,6 +301,45 @@ provided via plugins. To see them, simply run with +--help+:
|
|
|
294
301
|
-p, --pride Pride. Show your testing pride!
|
|
295
302
|
-a, --autotest Connect to autotest server.
|
|
296
303
|
|
|
304
|
+
=== Rake Tasks
|
|
305
|
+
|
|
306
|
+
You can set up a rake task to run all your tests by adding this to your Rakefile:
|
|
307
|
+
|
|
308
|
+
require "minitest/test_task"
|
|
309
|
+
|
|
310
|
+
Minitest::TestTask.create # named test, sensible defaults
|
|
311
|
+
|
|
312
|
+
# or more explicitly:
|
|
313
|
+
|
|
314
|
+
Minitest::TestTask.create(:test) do |t|
|
|
315
|
+
t.libs << "test"
|
|
316
|
+
t.libs << "lib"
|
|
317
|
+
t.warning = false
|
|
318
|
+
t.test_globs = ["test/**/*_test.rb"]
|
|
319
|
+
end
|
|
320
|
+
|
|
321
|
+
task :default => :test
|
|
322
|
+
|
|
323
|
+
Each of these will generate 4 tasks:
|
|
324
|
+
|
|
325
|
+
rake test :: Run the test suite.
|
|
326
|
+
rake test:cmd :: Print out the test command.
|
|
327
|
+
rake test:isolated :: Show which test files fail when run separately.
|
|
328
|
+
rake test:slow :: Show bottom 25 tests sorted by time.
|
|
329
|
+
|
|
330
|
+
=== Rake Task Variables
|
|
331
|
+
|
|
332
|
+
There are a bunch of variables you can supply to rake to modify the run.
|
|
333
|
+
|
|
334
|
+
MT_LIB_EXTRAS :: Extra libs to dynamically override/inject for custom runs.
|
|
335
|
+
N :: -n: Tests to run (string or /regexp/).
|
|
336
|
+
X :: -x: Tests to exclude (string or /regexp/).
|
|
337
|
+
A :: Any extra arguments. Honors shell quoting.
|
|
338
|
+
MT_CPU :: How many threads to use for parallel test runs
|
|
339
|
+
SEED :: -s --seed Sets random seed.
|
|
340
|
+
TESTOPTS :: Deprecated, same as A
|
|
341
|
+
FILTER :: Deprecated, same as A
|
|
342
|
+
|
|
297
343
|
== Writing Extensions
|
|
298
344
|
|
|
299
345
|
To define a plugin, add a file named minitest/XXX_plugin.rb to your
|
|
@@ -364,6 +410,46 @@ Using our example above, here is how we might implement MyCI:
|
|
|
364
410
|
|
|
365
411
|
== FAQ
|
|
366
412
|
|
|
413
|
+
=== What versions are compatible with what? Or what versions are supported?
|
|
414
|
+
|
|
415
|
+
Minitest is a dependency of rails, which until very recently had an
|
|
416
|
+
overzealous backwards compatibility policy. As such, I'm stuck
|
|
417
|
+
supporting versions of ruby that are long past EOL. Hopefully I'll be
|
|
418
|
+
able to support only current versions of ruby sometime in the near
|
|
419
|
+
future.
|
|
420
|
+
|
|
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)
|
|
426
|
+
|
|
427
|
+
Current versions of rails: (https://endoflife.date/rails)
|
|
428
|
+
|
|
429
|
+
| rails | min ruby | minitest | status | EOL Date |
|
|
430
|
+
|-------+----------+----------+----------+------------|
|
|
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 |
|
|
435
|
+
|
|
436
|
+
If you want to look at the requirements for a specific version, run:
|
|
437
|
+
|
|
438
|
+
gem spec -r --ruby rails -v 8.0.0
|
|
439
|
+
|
|
440
|
+
Current versions of ruby: (https://endoflife.date/ruby)
|
|
441
|
+
|
|
442
|
+
| ruby | Status | EOL Date |
|
|
443
|
+
|------+---------+------------|
|
|
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 |
|
|
448
|
+
| 3.0 | EOL | 2024-03-31 |
|
|
449
|
+
| 2.7 | EOL | 2023-03-31 |
|
|
450
|
+
| 2.6 | EOL | 2022-03-31 |
|
|
451
|
+
| 2.5 | EOL | 2021-03-31 |
|
|
452
|
+
|
|
367
453
|
=== How to test SimpleDelegates?
|
|
368
454
|
|
|
369
455
|
The following implementation and test:
|
|
@@ -379,7 +465,7 @@ The following implementation and test:
|
|
|
379
465
|
end
|
|
380
466
|
|
|
381
467
|
it "must respond to work" do
|
|
382
|
-
@worker.must_respond_to :work
|
|
468
|
+
_(@worker).must_respond_to :work
|
|
383
469
|
end
|
|
384
470
|
end
|
|
385
471
|
|
|
@@ -469,6 +555,8 @@ able to require minitest and run your tests.
|
|
|
469
555
|
|
|
470
556
|
== Developing Minitest:
|
|
471
557
|
|
|
558
|
+
Minitest requires {Hoe}[https://rubygems.org/gems/hoe].
|
|
559
|
+
|
|
472
560
|
=== Minitest's own tests require UTF-8 external encoding.
|
|
473
561
|
|
|
474
562
|
This is a common problem in Windows, where the default external Encoding is
|
|
@@ -547,6 +635,7 @@ minispec-metadata :: Metadata for describe/it blocks & CLI tag filter.
|
|
|
547
635
|
E.g. <tt>it "requires JS driver", js: true do</tt> &
|
|
548
636
|
<tt>ruby test.rb --tag js</tt> runs tests tagged :js.
|
|
549
637
|
minispec-rails :: Minimal support to use Spec style in Rails 5+.
|
|
638
|
+
mini-apivore :: for swagger based automated API testing.
|
|
550
639
|
minitest-around :: Around block for minitest. An alternative to
|
|
551
640
|
setup/teardown dance.
|
|
552
641
|
minitest-assert_errors :: Adds Minitest assertions to test for errors raised
|
|
@@ -563,6 +652,7 @@ minitest-capistrano :: Assertions and expectations for testing
|
|
|
563
652
|
Capistrano recipes.
|
|
564
653
|
minitest-capybara :: Capybara matchers support for minitest unit and
|
|
565
654
|
spec.
|
|
655
|
+
minitest-cc :: It provides minimal information about code coverage.
|
|
566
656
|
minitest-chef-handler :: Run Minitest suites as Chef report handlers
|
|
567
657
|
minitest-ci :: CI reporter plugin for Minitest.
|
|
568
658
|
minitest-context :: Defines contexts for code reuse in Minitest
|
|
@@ -589,12 +679,14 @@ minitest-firemock :: Makes your Minitest mocks more resilient.
|
|
|
589
679
|
minitest-focus :: Focus on one test at a time.
|
|
590
680
|
minitest-gcstats :: A minitest plugin that adds a report of the top
|
|
591
681
|
tests by number of objects allocated.
|
|
682
|
+
minitest-global_expectations:: Support minitest expectation methods for all objects
|
|
592
683
|
minitest-great_expectations :: Generally useful additions to minitest's
|
|
593
684
|
assertions and expectations.
|
|
594
685
|
minitest-growl :: Test notifier for minitest via growl.
|
|
595
686
|
minitest-happy :: GLOBALLY ACTIVATE MINITEST PRIDE! RAWR!
|
|
596
687
|
minitest-have_tag :: Adds Minitest assertions to test for the existence of
|
|
597
688
|
HTML tags, including contents, within a provided string.
|
|
689
|
+
minitest-heat :: Reporting that builds a heat map of failure locations
|
|
598
690
|
minitest-hooks :: Around and before_all/after_all/around_all hooks
|
|
599
691
|
minitest-hyper :: Pretty, single-page HTML reports for your Minitest runs
|
|
600
692
|
minitest-implicit-subject :: Implicit declaration of the test subject.
|
|
@@ -615,6 +707,7 @@ minitest-matchers :: Adds support for RSpec-style matchers to
|
|
|
615
707
|
minitest-matchers_vaccine :: Adds assertions that adhere to the matcher spec,
|
|
616
708
|
but without any expectation infections.
|
|
617
709
|
minitest-metadata :: Annotate tests with metadata (key-value).
|
|
710
|
+
minitest-mock_expectations :: Provides method call assertions for minitest.
|
|
618
711
|
minitest-mongoid :: Mongoid assertion matchers for Minitest.
|
|
619
712
|
minitest-must_not :: Provides must_not as an alias for wont in
|
|
620
713
|
Minitest.
|
|
@@ -658,16 +751,23 @@ minitest-stub-const :: Stub constants for the duration of a block.
|
|
|
658
751
|
minitest-tags :: Add tags for minitest.
|
|
659
752
|
minitest-unordered :: Adds a new assertion to minitest for checking the
|
|
660
753
|
contents of a collection, ignoring element order.
|
|
661
|
-
minitest-vcr :: Automatic cassette
|
|
754
|
+
minitest-vcr :: Automatic cassette management with Minitest::Spec
|
|
662
755
|
and VCR.
|
|
756
|
+
minitest_log :: Adds structured logging, data explication, and verdicts.
|
|
663
757
|
minitest_owrapper :: Get tests results as a TestResult object.
|
|
664
758
|
minitest_should :: Shoulda style syntax for minitest test::unit.
|
|
665
759
|
minitest_tu_shim :: Bridges between test/unit and minitest.
|
|
666
760
|
mongoid-minitest :: Minitest matchers for Mongoid.
|
|
761
|
+
mutant-minitest :: Minitest integration for mutant.
|
|
667
762
|
pry-rescue :: A pry plugin w/ minitest support. See
|
|
668
763
|
pry-rescue/minitest.rb.
|
|
764
|
+
rematch :: Declutter your test files from large hardcoded data
|
|
765
|
+
and update them automatically when your code changes.
|
|
669
766
|
rspec2minitest :: Easily translate any RSpec matchers to Minitest
|
|
670
767
|
assertions and expectations.
|
|
768
|
+
stubberry :: Multiple stubbing 'berries', sweet and useful
|
|
769
|
+
stub helpers and assertions. ( stub_must,
|
|
770
|
+
assert_method_called, stubbing ORM objects by id )
|
|
671
771
|
|
|
672
772
|
== Unknown Extensions:
|
|
673
773
|
|
|
@@ -693,12 +793,11 @@ Authors... Please send me a pull request with a description of your minitest ext
|
|
|
693
793
|
|
|
694
794
|
== Minitest related goods
|
|
695
795
|
|
|
696
|
-
* minitest/pride fabric:
|
|
796
|
+
* minitest/pride fabric: https://www.spoonflower.com/fabric/3928730-again-by-katie_allen
|
|
697
797
|
|
|
698
798
|
== REQUIREMENTS:
|
|
699
799
|
|
|
700
|
-
* Ruby
|
|
701
|
-
* NOTE: 1.8 and 1.9 will be dropped in minitest 6+.
|
|
800
|
+
* Ruby 2.3+. No magic is involved. I hope.
|
|
702
801
|
|
|
703
802
|
== INSTALL:
|
|
704
803
|
|
data/Rakefile
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# -*- ruby -*-
|
|
2
2
|
|
|
3
|
-
require "rubygems"
|
|
4
3
|
require "hoe"
|
|
4
|
+
$:.unshift "lib" # to pick up lib/minitest/test_task.rb when minitest not installed
|
|
5
5
|
|
|
6
6
|
Hoe.plugin :seattlerb
|
|
7
7
|
Hoe.plugin :rdoc
|
|
@@ -11,21 +11,24 @@ Hoe.spec "minitest" do
|
|
|
11
11
|
|
|
12
12
|
license "MIT"
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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
|
|
29
32
|
end
|
|
30
33
|
|
|
31
34
|
desc "Find missing expectations"
|
|
@@ -35,7 +38,7 @@ task :specs do
|
|
|
35
38
|
require "minitest/spec"
|
|
36
39
|
|
|
37
40
|
pos_prefix, neg_prefix = "must", "wont"
|
|
38
|
-
skip_re = /^(must|wont)$|wont_(throw)|must_(block|not?_|nothing|raise$)/x
|
|
41
|
+
skip_re = /^(must|wont)$|wont_(throw)|must_(block|not?_|nothing|send|raise$)/x
|
|
39
42
|
dont_flip_re = /(must|wont)_(include|respond_to)/
|
|
40
43
|
|
|
41
44
|
map = {
|
|
@@ -46,6 +49,9 @@ task :specs do
|
|
|
46
49
|
/_includes/ => "_include",
|
|
47
50
|
/(must|wont)_(.*_of|nil|silent|empty)/ => '\1_be_\2',
|
|
48
51
|
/must_raises/ => "must_raise",
|
|
52
|
+
/(must|wont)_pattern/ => '\1_pattern_match',
|
|
53
|
+
/(must|wont)_predicate/ => '\1_be',
|
|
54
|
+
/(must|wont)_path_exists/ => 'path_\1_exist',
|
|
49
55
|
}
|
|
50
56
|
|
|
51
57
|
expectations = Minitest::Expectations.public_instance_methods.map(&:to_s)
|
|
@@ -83,4 +89,9 @@ task :bugs do
|
|
|
83
89
|
sh "for f in bug*.rb ; do echo $f; echo; #{Gem.ruby} -Ilib $f && rm $f ; done"
|
|
84
90
|
end
|
|
85
91
|
|
|
92
|
+
Minitest::TestTask.create :testW0 do |t|
|
|
93
|
+
t.warning = false
|
|
94
|
+
t.test_prelude = "$-w = nil"
|
|
95
|
+
end
|
|
96
|
+
|
|
86
97
|
# vim: syntax=Ruby
|
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
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# :stopdoc:
|
|
2
2
|
|
|
3
3
|
class Hoe
|
|
4
|
+
# empty
|
|
4
5
|
end
|
|
5
6
|
|
|
6
7
|
module Hoe::Minitest
|
|
@@ -10,13 +11,14 @@ module Hoe::Minitest
|
|
|
10
11
|
|
|
11
12
|
def initialize_minitest
|
|
12
13
|
unless minitest? then
|
|
13
|
-
dir = "
|
|
14
|
+
dir = File.expand_path "../..", __FILE__
|
|
15
|
+
|
|
14
16
|
Hoe.add_include_dirs dir if File.directory? dir
|
|
15
17
|
end
|
|
16
18
|
|
|
17
19
|
gem "minitest"
|
|
18
20
|
require "minitest"
|
|
19
|
-
version = Minitest::VERSION.split(
|
|
21
|
+
version = Minitest::VERSION.split(".").first(2).join "."
|
|
20
22
|
|
|
21
23
|
dependency "minitest", "~> #{version}", :development unless
|
|
22
24
|
minitest? or ENV["MT_NO_ISOLATE"]
|
|
@@ -24,9 +26,5 @@ module Hoe::Minitest
|
|
|
24
26
|
|
|
25
27
|
def define_minitest_tasks
|
|
26
28
|
self.testlib = :minitest
|
|
27
|
-
|
|
28
|
-
# make sure we use the gemmed minitest on 1.9
|
|
29
|
-
self.test_prelude = 'gem "minitest"' unless
|
|
30
|
-
minitest? or ENV["MT_NO_ISOLATE"]
|
|
31
29
|
end
|
|
32
30
|
end
|