rack-link_headers 2.4.0 → 2.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rack/link_headers/version.rb +1 -1
- data/rack-link-headers.gemspec +2 -2
- data/vendor/bundle/ruby/3.3.0/bundler/gems/rubocop-config-943facea9d8f/LICENSE +21 -0
- data/vendor/bundle/ruby/3.3.0/bundler/gems/rubocop-config-943facea9d8f/README.md +23 -0
- data/vendor/bundle/ruby/3.3.0/bundler/gems/rubocop-config-943facea9d8f/rubocop-config.gemspec +31 -0
- data/vendor/bundle/ruby/3.3.0/gems/ast-2.4.2/LICENSE.MIT +20 -0
- data/vendor/bundle/ruby/3.3.0/gems/ast-2.4.2/README.YARD.md +12 -0
- data/vendor/bundle/ruby/3.3.0/gems/json-2.7.2/LICENSE +56 -0
- data/vendor/bundle/ruby/3.3.0/gems/json-2.7.2/README.md +416 -0
- data/vendor/bundle/ruby/3.3.0/gems/json-2.7.2/json.gemspec +68 -0
- data/vendor/bundle/ruby/3.3.0/gems/language_server-protocol-3.17.0.3/LICENSE.txt +21 -0
- data/vendor/bundle/ruby/3.3.0/gems/language_server-protocol-3.17.0.3/README.md +88 -0
- data/vendor/bundle/ruby/3.3.0/gems/minitest-5.25.1/README.rdoc +835 -0
- data/vendor/bundle/ruby/3.3.0/gems/parallel-1.26.3/MIT-LICENSE.txt +20 -0
- data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.5.0/LICENSE.txt +25 -0
- data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.5.0/parser.gemspec +43 -0
- data/vendor/bundle/ruby/3.3.0/gems/racc-1.8.1/README.ja.rdoc +58 -0
- data/vendor/bundle/ruby/3.3.0/gems/racc-1.8.1/README.rdoc +60 -0
- data/vendor/bundle/ruby/3.3.0/gems/rack-3.1.7/CHANGELOG.md +994 -0
- data/vendor/bundle/ruby/3.3.0/gems/rack-3.1.7/MIT-LICENSE +20 -0
- data/vendor/bundle/ruby/3.3.0/gems/rack-3.1.7/README.md +328 -0
- data/vendor/bundle/ruby/3.3.0/gems/rainbow-3.1.1/LICENSE +20 -0
- data/vendor/bundle/ruby/3.3.0/gems/rainbow-3.1.1/README.markdown +227 -0
- data/vendor/bundle/ruby/3.3.0/gems/rake-13.2.1/MIT-LICENSE +21 -0
- data/vendor/bundle/ruby/3.3.0/gems/rake-13.2.1/README.rdoc +155 -0
- data/vendor/bundle/ruby/3.3.0/gems/rake-13.2.1/rake.gemspec +101 -0
- data/vendor/bundle/ruby/3.3.0/gems/rake-release-1.3.0/LICENSE +21 -0
- data/vendor/bundle/ruby/3.3.0/gems/rake-release-1.3.0/README.md +107 -0
- data/vendor/bundle/ruby/3.3.0/gems/rake-release-1.3.0/rake-release.gemspec +23 -0
- data/vendor/bundle/ruby/3.3.0/gems/regexp_parser-2.9.2/LICENSE +22 -0
- data/vendor/bundle/ruby/3.3.0/gems/regexp_parser-2.9.2/regexp_parser.gemspec +34 -0
- data/vendor/bundle/ruby/3.3.0/gems/rexml-3.3.7/LICENSE.txt +22 -0
- data/vendor/bundle/ruby/3.3.0/gems/rexml-3.3.7/README.md +57 -0
- data/vendor/bundle/ruby/3.3.0/gems/rubocop-1.65.1/LICENSE.txt +20 -0
- data/vendor/bundle/ruby/3.3.0/gems/rubocop-1.65.1/README.md +251 -0
- data/vendor/bundle/ruby/3.3.0/gems/rubocop-ast-1.32.3/LICENSE.txt +20 -0
- data/vendor/bundle/ruby/3.3.0/gems/rubocop-ast-1.32.3/README.md +56 -0
- data/vendor/bundle/ruby/3.3.0/gems/rubocop-capybara-2.21.0/CHANGELOG.md +85 -0
- data/vendor/bundle/ruby/3.3.0/gems/rubocop-capybara-2.21.0/MIT-LICENSE.md +21 -0
- data/vendor/bundle/ruby/3.3.0/gems/rubocop-capybara-2.21.0/README.md +88 -0
- data/vendor/bundle/ruby/3.3.0/gems/rubocop-factory_bot-2.26.1/CHANGELOG.md +116 -0
- data/vendor/bundle/ruby/3.3.0/gems/rubocop-factory_bot-2.26.1/MIT-LICENSE.md +21 -0
- data/vendor/bundle/ruby/3.3.0/gems/rubocop-factory_bot-2.26.1/README.md +88 -0
- data/vendor/bundle/ruby/3.3.0/gems/rubocop-performance-1.21.1/LICENSE.txt +20 -0
- data/vendor/bundle/ruby/3.3.0/gems/rubocop-performance-1.21.1/README.md +97 -0
- data/vendor/bundle/ruby/3.3.0/gems/rubocop-rspec-3.0.5/CHANGELOG.md +1034 -0
- data/vendor/bundle/ruby/3.3.0/gems/rubocop-rspec-3.0.5/MIT-LICENSE.md +21 -0
- data/vendor/bundle/ruby/3.3.0/gems/rubocop-rspec-3.0.5/README.md +109 -0
- data/vendor/bundle/ruby/3.3.0/gems/rubocop-rspec_rails-2.30.0/CHANGELOG.md +84 -0
- data/vendor/bundle/ruby/3.3.0/gems/rubocop-rspec_rails-2.30.0/MIT-LICENSE.md +21 -0
- data/vendor/bundle/ruby/3.3.0/gems/rubocop-rspec_rails-2.30.0/README.md +90 -0
- data/vendor/bundle/ruby/3.3.0/gems/ruby-progressbar-1.13.0/LICENSE.txt +19 -0
- data/vendor/bundle/ruby/3.3.0/gems/ruby-progressbar-1.13.0/README.md +131 -0
- data/vendor/bundle/ruby/3.3.0/gems/unicode-display_width-2.6.0/CHANGELOG.md +200 -0
- data/vendor/bundle/ruby/3.3.0/gems/unicode-display_width-2.6.0/MIT-LICENSE.txt +22 -0
- data/vendor/bundle/ruby/3.3.0/gems/unicode-display_width-2.6.0/README.md +171 -0
- data/vendor/bundle/ruby/3.3.0/specifications/ast-2.4.2.gemspec +30 -0
- data/vendor/bundle/ruby/3.3.0/specifications/json-2.7.2.gemspec +0 -0
- data/vendor/bundle/ruby/3.3.0/specifications/language_server-protocol-3.17.0.3.gemspec +31 -0
- data/vendor/bundle/ruby/3.3.0/specifications/minitest-5.25.1.gemspec +31 -0
- data/vendor/bundle/ruby/3.3.0/specifications/parallel-1.26.3.gemspec +21 -0
- data/vendor/bundle/ruby/3.3.0/specifications/parser-3.3.5.0.gemspec +37 -0
- data/vendor/bundle/ruby/3.3.0/specifications/racc-1.8.1.gemspec +28 -0
- data/vendor/bundle/ruby/3.3.0/specifications/rack-3.1.7.gemspec +31 -0
- data/vendor/bundle/ruby/3.3.0/specifications/rainbow-3.1.1.gemspec +25 -0
- data/vendor/bundle/ruby/3.3.0/specifications/rake-13.2.1.gemspec +26 -0
- data/vendor/bundle/ruby/3.3.0/specifications/rake-release-1.3.0.gemspec +26 -0
- data/vendor/bundle/ruby/3.3.0/specifications/regexp_parser-2.9.2.gemspec +22 -0
- data/vendor/bundle/ruby/3.3.0/specifications/rexml-3.3.7.gemspec +25 -0
- data/vendor/bundle/ruby/3.3.0/specifications/rubocop-1.65.1.gemspec +39 -0
- data/vendor/bundle/ruby/3.3.0/specifications/rubocop-ast-1.32.3.gemspec +28 -0
- data/vendor/bundle/ruby/3.3.0/specifications/rubocop-capybara-2.21.0.gemspec +27 -0
- data/vendor/bundle/ruby/3.3.0/specifications/rubocop-factory_bot-2.26.1.gemspec +27 -0
- data/vendor/bundle/ruby/3.3.0/specifications/rubocop-performance-1.21.1.gemspec +29 -0
- data/vendor/bundle/ruby/3.3.0/specifications/rubocop-rspec-3.0.5.gemspec +28 -0
- data/vendor/bundle/ruby/3.3.0/specifications/rubocop-rspec_rails-2.30.0.gemspec +28 -0
- data/vendor/bundle/ruby/3.3.0/specifications/ruby-progressbar-1.13.0.gemspec +29 -0
- data/vendor/bundle/ruby/3.3.0/specifications/unicode-display_width-2.6.0.gemspec +29 -0
- metadata +80 -4
@@ -0,0 +1,835 @@
|
|
1
|
+
= minitest/{test,spec,mock,benchmark}
|
2
|
+
|
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
|
7
|
+
vim :: https://github.com/sunaku/vim-ruby-minitest
|
8
|
+
emacs:: https://github.com/arthurnn/minitest-emacs
|
9
|
+
|
10
|
+
== DESCRIPTION:
|
11
|
+
|
12
|
+
minitest provides a complete suite of testing facilities supporting
|
13
|
+
TDD, BDD, mocking, and benchmarking.
|
14
|
+
|
15
|
+
"I had a class with Jim Weirich on testing last week and we were
|
16
|
+
allowed to choose our testing frameworks. Kirk Haines and I were
|
17
|
+
paired up and we cracked open the code for a few test
|
18
|
+
frameworks...
|
19
|
+
|
20
|
+
I MUST say that minitest is *very* readable / understandable
|
21
|
+
compared to the 'other two' options we looked at. Nicely done and
|
22
|
+
thank you for helping us keep our mental sanity."
|
23
|
+
|
24
|
+
-- Wayne E. Seguin
|
25
|
+
|
26
|
+
minitest/test is a small and incredibly fast unit testing framework.
|
27
|
+
It provides a rich set of assertions to make your tests clean and
|
28
|
+
readable.
|
29
|
+
|
30
|
+
minitest/spec is a functionally complete spec engine. It hooks onto
|
31
|
+
minitest/test and seamlessly bridges test assertions over to spec
|
32
|
+
expectations.
|
33
|
+
|
34
|
+
minitest/benchmark is an awesome way to assert the performance of your
|
35
|
+
algorithms in a repeatable manner. Now you can assert that your newb
|
36
|
+
co-worker doesn't replace your linear algorithm with an exponential
|
37
|
+
one!
|
38
|
+
|
39
|
+
minitest/mock by Steven Baker, is a beautifully tiny mock (and stub)
|
40
|
+
object framework.
|
41
|
+
|
42
|
+
minitest/pride shows pride in testing and adds coloring to your test
|
43
|
+
output. I guess it is an example of how to write IO pipes too. :P
|
44
|
+
|
45
|
+
minitest/test is meant to have a clean implementation for language
|
46
|
+
implementors that need a minimal set of methods to bootstrap a working
|
47
|
+
test suite. For example, there is no magic involved for test-case
|
48
|
+
discovery.
|
49
|
+
|
50
|
+
"Again, I can't praise enough the idea of a testing/specing
|
51
|
+
framework that I can actually read in full in one sitting!"
|
52
|
+
|
53
|
+
-- Piotr Szotkowski
|
54
|
+
|
55
|
+
Comparing to rspec:
|
56
|
+
|
57
|
+
rspec is a testing DSL. minitest is ruby.
|
58
|
+
|
59
|
+
-- Adam Hawkins, "Bow Before MiniTest"
|
60
|
+
|
61
|
+
minitest doesn't reinvent anything that ruby already provides, like:
|
62
|
+
classes, modules, inheritance, methods. This means you only have to
|
63
|
+
learn ruby to use minitest and all of your regular OO practices like
|
64
|
+
extract-method refactorings still apply.
|
65
|
+
|
66
|
+
== FEATURES/PROBLEMS:
|
67
|
+
|
68
|
+
* minitest/autorun - the easy and explicit way to run all your tests.
|
69
|
+
* minitest/test - a very fast, simple, and clean test system.
|
70
|
+
* minitest/spec - a very fast, simple, and clean spec system.
|
71
|
+
* minitest/mock - a simple and clean mock/stub system.
|
72
|
+
* minitest/benchmark - an awesome way to assert your algorithm's performance.
|
73
|
+
* minitest/pride - show your pride in testing!
|
74
|
+
* minitest/test_task - a full-featured and clean rake task generator.
|
75
|
+
* Incredibly small and fast runner, but no bells and whistles.
|
76
|
+
* Written by squishy human beings. Software can never be perfect. We will all eventually die.
|
77
|
+
|
78
|
+
== RATIONALE:
|
79
|
+
|
80
|
+
See design_rationale.rb to see how specs and tests work in minitest.
|
81
|
+
|
82
|
+
== SYNOPSIS:
|
83
|
+
|
84
|
+
Given that you'd like to test the following class:
|
85
|
+
|
86
|
+
class Meme
|
87
|
+
def i_can_has_cheezburger?
|
88
|
+
"OHAI!"
|
89
|
+
end
|
90
|
+
|
91
|
+
def will_it_blend?
|
92
|
+
"YES!"
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
=== Unit tests
|
97
|
+
|
98
|
+
Define your tests as methods beginning with +test_+.
|
99
|
+
|
100
|
+
require "minitest/autorun"
|
101
|
+
|
102
|
+
class TestMeme < Minitest::Test
|
103
|
+
def setup
|
104
|
+
@meme = Meme.new
|
105
|
+
end
|
106
|
+
|
107
|
+
def test_that_kitty_can_eat
|
108
|
+
assert_equal "OHAI!", @meme.i_can_has_cheezburger?
|
109
|
+
end
|
110
|
+
|
111
|
+
def test_that_it_will_not_blend
|
112
|
+
refute_match /^no/i, @meme.will_it_blend?
|
113
|
+
end
|
114
|
+
|
115
|
+
def test_that_will_be_skipped
|
116
|
+
skip "test this later"
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
=== Specs
|
121
|
+
|
122
|
+
require "minitest/autorun"
|
123
|
+
|
124
|
+
describe Meme do
|
125
|
+
before do
|
126
|
+
@meme = Meme.new
|
127
|
+
end
|
128
|
+
|
129
|
+
describe "when asked about cheeseburgers" do
|
130
|
+
it "must respond positively" do
|
131
|
+
_(@meme.i_can_has_cheezburger?).must_equal "OHAI!"
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
describe "when asked about blending possibilities" do
|
136
|
+
it "won't say no" do
|
137
|
+
_(@meme.will_it_blend?).wont_match /^no/i
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
For matchers support check out:
|
143
|
+
|
144
|
+
* https://github.com/wojtekmach/minitest-matchers
|
145
|
+
* https://github.com/rmm5t/minitest-matchers_vaccine
|
146
|
+
|
147
|
+
=== Benchmarks
|
148
|
+
|
149
|
+
Add benchmarks to your tests.
|
150
|
+
|
151
|
+
# optionally run benchmarks, good for CI-only work!
|
152
|
+
require "minitest/benchmark" if ENV["BENCH"]
|
153
|
+
|
154
|
+
class TestMeme < Minitest::Benchmark
|
155
|
+
# Override self.bench_range or default range is [1, 10, 100, 1_000, 10_000]
|
156
|
+
def bench_my_algorithm
|
157
|
+
assert_performance_linear 0.9999 do |n| # n is a range value
|
158
|
+
@obj.my_algorithm(n)
|
159
|
+
end
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
Or add them to your specs. If you make benchmarks optional, you'll
|
164
|
+
need to wrap your benchmarks in a conditional since the methods won't
|
165
|
+
be defined. In minitest 5, the describe name needs to match
|
166
|
+
<tt>/Bench(mark)?$/</tt>.
|
167
|
+
|
168
|
+
describe "Meme Benchmark" do
|
169
|
+
if ENV["BENCH"] then
|
170
|
+
bench_performance_linear "my_algorithm", 0.9999 do |n|
|
171
|
+
100.times do
|
172
|
+
@obj.my_algorithm(n)
|
173
|
+
end
|
174
|
+
end
|
175
|
+
end
|
176
|
+
end
|
177
|
+
|
178
|
+
outputs something like:
|
179
|
+
|
180
|
+
# Running benchmarks:
|
181
|
+
|
182
|
+
TestBlah 100 1000 10000
|
183
|
+
bench_my_algorithm 0.006167 0.079279 0.786993
|
184
|
+
bench_other_algorithm 0.061679 0.792797 7.869932
|
185
|
+
|
186
|
+
Output is tab-delimited to make it easy to paste into a spreadsheet.
|
187
|
+
|
188
|
+
=== Mocks
|
189
|
+
|
190
|
+
Mocks and stubs defined using terminology by Fowler & Meszaros at
|
191
|
+
https://www.martinfowler.com/bliki/TestDouble.html:
|
192
|
+
|
193
|
+
"Mocks are pre-programmed with expectations which form a specification
|
194
|
+
of the calls they are expected to receive. They can throw an exception
|
195
|
+
if they receive a call they don't expect and are checked during
|
196
|
+
verification to ensure they got all the calls they were expecting."
|
197
|
+
|
198
|
+
class MemeAsker
|
199
|
+
def initialize(meme)
|
200
|
+
@meme = meme
|
201
|
+
end
|
202
|
+
|
203
|
+
def ask(question)
|
204
|
+
method = question.tr(" ", "_") + "?"
|
205
|
+
@meme.__send__(method)
|
206
|
+
end
|
207
|
+
end
|
208
|
+
|
209
|
+
require "minitest/autorun"
|
210
|
+
|
211
|
+
describe MemeAsker, :ask do
|
212
|
+
describe "when passed an unpunctuated question" do
|
213
|
+
it "should invoke the appropriate predicate method on the meme" do
|
214
|
+
@meme = Minitest::Mock.new
|
215
|
+
@meme_asker = MemeAsker.new @meme
|
216
|
+
@meme.expect :will_it_blend?, :return_value
|
217
|
+
|
218
|
+
@meme_asker.ask "will it blend"
|
219
|
+
|
220
|
+
@meme.verify
|
221
|
+
end
|
222
|
+
end
|
223
|
+
end
|
224
|
+
|
225
|
+
==== Multi-threading and Mocks
|
226
|
+
|
227
|
+
Minitest mocks do not support multi-threading. If it works, fine, if it doesn't
|
228
|
+
you can use regular ruby patterns and facilities like local variables. Here's
|
229
|
+
an example of asserting that code inside a thread is run:
|
230
|
+
|
231
|
+
def test_called_inside_thread
|
232
|
+
called = false
|
233
|
+
pr = Proc.new { called = true }
|
234
|
+
thread = Thread.new(&pr)
|
235
|
+
thread.join
|
236
|
+
assert called, "proc not called"
|
237
|
+
end
|
238
|
+
|
239
|
+
=== Stubs
|
240
|
+
|
241
|
+
Mocks and stubs are defined using terminology by Fowler & Meszaros at
|
242
|
+
https://www.martinfowler.com/bliki/TestDouble.html:
|
243
|
+
|
244
|
+
"Stubs provide canned answers to calls made during the test".
|
245
|
+
|
246
|
+
Minitest's stub method overrides a single method for the duration of
|
247
|
+
the block.
|
248
|
+
|
249
|
+
def test_stale_eh
|
250
|
+
obj_under_test = Something.new
|
251
|
+
|
252
|
+
refute obj_under_test.stale?
|
253
|
+
|
254
|
+
Time.stub :now, Time.at(0) do # stub goes away once the block is done
|
255
|
+
assert obj_under_test.stale?
|
256
|
+
end
|
257
|
+
end
|
258
|
+
|
259
|
+
A note on stubbing: In order to stub a method, the method must
|
260
|
+
actually exist prior to stubbing. Use a singleton method to create a
|
261
|
+
new non-existing method:
|
262
|
+
|
263
|
+
def obj_under_test.fake_method
|
264
|
+
...
|
265
|
+
end
|
266
|
+
|
267
|
+
=== Running Your Tests
|
268
|
+
|
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:
|
271
|
+
|
272
|
+
% ruby -Ilib:test test/minitest/test_minitest_test.rb
|
273
|
+
Run options: --seed 37685
|
274
|
+
|
275
|
+
# Running:
|
276
|
+
|
277
|
+
...................................................................... (etc)
|
278
|
+
|
279
|
+
Finished in 0.107130s, 1446.8403 runs/s, 2959.0217 assertions/s.
|
280
|
+
|
281
|
+
155 runs, 317 assertions, 0 failures, 0 errors, 0 skips
|
282
|
+
|
283
|
+
There are runtime options available, both from minitest itself, and also
|
284
|
+
provided via plugins. To see them, simply run with +--help+:
|
285
|
+
|
286
|
+
% ruby -Ilib:test test/minitest/test_minitest_test.rb --help
|
287
|
+
minitest options:
|
288
|
+
-h, --help Display this help.
|
289
|
+
-s, --seed SEED Sets random seed. Also via env. Eg: SEED=n rake
|
290
|
+
-v, --verbose Verbose. Show progress processing files.
|
291
|
+
-n, --name PATTERN Filter run on /regexp/ or string.
|
292
|
+
-e, --exclude PATTERN Exclude /regexp/ or string from run.
|
293
|
+
|
294
|
+
Known extensions: pride, autotest
|
295
|
+
-p, --pride Pride. Show your testing pride!
|
296
|
+
-a, --autotest Connect to autotest server.
|
297
|
+
|
298
|
+
=== Rake Tasks
|
299
|
+
|
300
|
+
You can set up a rake task to run all your tests by adding this to your Rakefile:
|
301
|
+
|
302
|
+
require "minitest/test_task"
|
303
|
+
|
304
|
+
Minitest::TestTask.create # named test, sensible defaults
|
305
|
+
|
306
|
+
# or more explicitly:
|
307
|
+
|
308
|
+
Minitest::TestTask.create(:test) do |t|
|
309
|
+
t.libs << "test"
|
310
|
+
t.libs << "lib"
|
311
|
+
t.warning = false
|
312
|
+
t.test_globs = ["test/**/*_test.rb"]
|
313
|
+
end
|
314
|
+
|
315
|
+
task :default => :test
|
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
|
+
|
337
|
+
== Writing Extensions
|
338
|
+
|
339
|
+
To define a plugin, add a file named minitest/XXX_plugin.rb to your
|
340
|
+
project/gem. That file must be discoverable via ruby's LOAD_PATH (via
|
341
|
+
rubygems or otherwise). Minitest will find and require that file using
|
342
|
+
Gem.find_files. It will then try to call +plugin_XXX_init+ during
|
343
|
+
startup. The option processor will also try to call +plugin_XXX_options+
|
344
|
+
passing the OptionParser instance and the current options hash. This
|
345
|
+
lets you register your own command-line options. Here's a totally
|
346
|
+
bogus example:
|
347
|
+
|
348
|
+
# minitest/bogus_plugin.rb:
|
349
|
+
|
350
|
+
module Minitest
|
351
|
+
def self.plugin_bogus_options(opts, options)
|
352
|
+
opts.on "--myci", "Report results to my CI" do
|
353
|
+
options[:myci] = true
|
354
|
+
options[:myci_addr] = get_myci_addr
|
355
|
+
options[:myci_port] = get_myci_port
|
356
|
+
end
|
357
|
+
end
|
358
|
+
|
359
|
+
def self.plugin_bogus_init(options)
|
360
|
+
self.reporter << MyCI.new(options) if options[:myci]
|
361
|
+
end
|
362
|
+
end
|
363
|
+
|
364
|
+
=== Adding custom reporters
|
365
|
+
|
366
|
+
Minitest uses composite reporter to output test results using multiple
|
367
|
+
reporter instances. You can add new reporters to the composite during
|
368
|
+
the init_plugins phase. As we saw in +plugin_bogus_init+ above, you
|
369
|
+
simply add your reporter instance to the composite via <tt><<</tt>.
|
370
|
+
|
371
|
+
+AbstractReporter+ defines the API for reporters. You may subclass it
|
372
|
+
and override any method you want to achieve your desired behavior.
|
373
|
+
|
374
|
+
start :: Called when the run has started.
|
375
|
+
record :: Called for each result, passed or otherwise.
|
376
|
+
report :: Called at the end of the run.
|
377
|
+
passed? :: Called to see if you detected any problems.
|
378
|
+
|
379
|
+
Using our example above, here is how we might implement MyCI:
|
380
|
+
|
381
|
+
# minitest/bogus_plugin.rb
|
382
|
+
|
383
|
+
module Minitest
|
384
|
+
class MyCI < AbstractReporter
|
385
|
+
attr_accessor :results, :addr, :port
|
386
|
+
|
387
|
+
def initialize options
|
388
|
+
self.results = []
|
389
|
+
self.addr = options[:myci_addr]
|
390
|
+
self.port = options[:myci_port]
|
391
|
+
end
|
392
|
+
|
393
|
+
def record result
|
394
|
+
self.results << result
|
395
|
+
end
|
396
|
+
|
397
|
+
def report
|
398
|
+
CI.connect(addr, port).send_results self.results
|
399
|
+
end
|
400
|
+
end
|
401
|
+
|
402
|
+
# code from above...
|
403
|
+
end
|
404
|
+
|
405
|
+
== FAQ
|
406
|
+
|
407
|
+
=== What versions are compatible with what? Or what versions are supported?
|
408
|
+
|
409
|
+
Minitest is a dependency of rails, which until very 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 2024-05-10)
|
416
|
+
|
417
|
+
Current versions of rails: (https://endoflife.date/rails)
|
418
|
+
|
419
|
+
| rails | min ruby | minitest | status | EOL Date |
|
420
|
+
|-------+----------+----------+----------+------------|
|
421
|
+
| 7.1 | >= 2.7 | >= 5.1 | Current | 2026-06-01?|
|
422
|
+
| 7.0 | >= 2.7 | >= 5.1 | Maint | 2025-06-01?|
|
423
|
+
| 6.1 | >= 2.5 | >= 5.1 | Security | 2024-06-01?|
|
424
|
+
| 6.0 | >= 2.5 | >= 5.1 | EOL | 2023-06-01 |
|
425
|
+
| 5.2 | >= 2.2.2 | ~> 5.1 | EOL | 2022-06-01 |
|
426
|
+
|
427
|
+
If you want to look at the requirements for a specific version, run:
|
428
|
+
|
429
|
+
gem spec -r --ruby rails -v 7.0.0
|
430
|
+
|
431
|
+
Current versions of ruby: (https://endoflife.date/ruby)
|
432
|
+
|
433
|
+
| ruby | Status | EOL Date |
|
434
|
+
|------+---------+------------|
|
435
|
+
| 3.3 | Current | 2027-03-31 |
|
436
|
+
| 3.2 | Maint | 2026-03-31 |
|
437
|
+
| 3.1 | Security| 2025-03-31 |
|
438
|
+
| 3.0 | EOL | 2024-03-31 |
|
439
|
+
| 2.7 | EOL | 2023-03-31 |
|
440
|
+
| 2.6 | EOL | 2022-03-31 |
|
441
|
+
| 2.5 | EOL | 2021-03-31 | DO YOU SEE WHAT I'M STUCK WITH???
|
442
|
+
|
443
|
+
=== How to test SimpleDelegates?
|
444
|
+
|
445
|
+
The following implementation and test:
|
446
|
+
|
447
|
+
class Worker < SimpleDelegator
|
448
|
+
def work
|
449
|
+
end
|
450
|
+
end
|
451
|
+
|
452
|
+
describe Worker do
|
453
|
+
before do
|
454
|
+
@worker = Worker.new(Object.new)
|
455
|
+
end
|
456
|
+
|
457
|
+
it "must respond to work" do
|
458
|
+
_(@worker).must_respond_to :work
|
459
|
+
end
|
460
|
+
end
|
461
|
+
|
462
|
+
outputs a failure:
|
463
|
+
|
464
|
+
1) Failure:
|
465
|
+
Worker#test_0001_must respond to work [bug11.rb:16]:
|
466
|
+
Expected #<Object:0x007f9e7184f0a0> (Object) to respond to #work.
|
467
|
+
|
468
|
+
Worker is a SimpleDelegate which in 1.9+ is a subclass of BasicObject.
|
469
|
+
Expectations are put on Object (one level down) so the Worker
|
470
|
+
(SimpleDelegate) hits +method_missing+ and delegates down to the
|
471
|
+
+Object.new+ instance. That object doesn't respond to work so the test
|
472
|
+
fails.
|
473
|
+
|
474
|
+
You can bypass <tt>SimpleDelegate#method_missing</tt> by extending the worker
|
475
|
+
with <tt>Minitest::Expectations</tt>. You can either do that in your setup at
|
476
|
+
the instance level, like:
|
477
|
+
|
478
|
+
before do
|
479
|
+
@worker = Worker.new(Object.new)
|
480
|
+
@worker.extend Minitest::Expectations
|
481
|
+
end
|
482
|
+
|
483
|
+
or you can extend the Worker class (within the test file!), like:
|
484
|
+
|
485
|
+
class Worker
|
486
|
+
include ::Minitest::Expectations
|
487
|
+
end
|
488
|
+
|
489
|
+
=== How to share code across test classes?
|
490
|
+
|
491
|
+
Use a module. That's exactly what they're for:
|
492
|
+
|
493
|
+
module UsefulStuff
|
494
|
+
def useful_method
|
495
|
+
# ...
|
496
|
+
end
|
497
|
+
end
|
498
|
+
|
499
|
+
describe Blah do
|
500
|
+
include UsefulStuff
|
501
|
+
|
502
|
+
def test_whatever
|
503
|
+
# useful_method available here
|
504
|
+
end
|
505
|
+
end
|
506
|
+
|
507
|
+
Remember, +describe+ simply creates test classes. It's just ruby at
|
508
|
+
the end of the day and all your normal Good Ruby Rules (tm) apply. If
|
509
|
+
you want to extend your test using setup/teardown via a module, just
|
510
|
+
make sure you ALWAYS call super. before/after automatically call super
|
511
|
+
for you, so make sure you don't do it twice.
|
512
|
+
|
513
|
+
=== How to run code before a group of tests?
|
514
|
+
|
515
|
+
Use a constant with begin...end like this:
|
516
|
+
|
517
|
+
describe Blah do
|
518
|
+
SETUP = begin
|
519
|
+
# ... this runs once when describe Blah starts
|
520
|
+
end
|
521
|
+
# ...
|
522
|
+
end
|
523
|
+
|
524
|
+
This can be useful for expensive initializations or sharing state.
|
525
|
+
Remember, this is just ruby code, so you need to make sure this
|
526
|
+
technique and sharing state doesn't interfere with your tests.
|
527
|
+
|
528
|
+
=== Why am I seeing <tt>uninitialized constant MiniTest::Test (NameError)</tt>?
|
529
|
+
|
530
|
+
Are you running the test with Bundler (e.g. via <tt>bundle exec</tt> )? If so,
|
531
|
+
in order to require minitest, you must first add the <tt>gem 'minitest'</tt>
|
532
|
+
to your Gemfile and run +bundle+. Once it's installed, you should be
|
533
|
+
able to require minitest and run your tests.
|
534
|
+
|
535
|
+
== Prominent Projects using Minitest:
|
536
|
+
|
537
|
+
* arel
|
538
|
+
* journey
|
539
|
+
* mime-types
|
540
|
+
* nokogiri
|
541
|
+
* rails (active_support et al)
|
542
|
+
* rake
|
543
|
+
* rdoc
|
544
|
+
* ...and of course, everything from seattle.rb...
|
545
|
+
|
546
|
+
== Developing Minitest:
|
547
|
+
|
548
|
+
Minitest requires {Hoe}[https://rubygems.org/gems/hoe].
|
549
|
+
|
550
|
+
=== Minitest's own tests require UTF-8 external encoding.
|
551
|
+
|
552
|
+
This is a common problem in Windows, where the default external Encoding is
|
553
|
+
often CP850, but can affect any platform.
|
554
|
+
Minitest can run test suites using any Encoding, but to run Minitest's
|
555
|
+
own tests you must have a default external Encoding of UTF-8.
|
556
|
+
|
557
|
+
If your encoding is wrong, you'll see errors like:
|
558
|
+
|
559
|
+
--- expected
|
560
|
+
+++ actual
|
561
|
+
@@ -1,2 +1,3 @@
|
562
|
+
# encoding: UTF-8
|
563
|
+
-"Expected /\\w+/ to not match \"blah blah blah\"."
|
564
|
+
+"Expected /\\w+/ to not match # encoding: UTF-8
|
565
|
+
+\"blah blah blah\"."
|
566
|
+
|
567
|
+
To check your current encoding, run:
|
568
|
+
|
569
|
+
ruby -e 'puts Encoding.default_external'
|
570
|
+
|
571
|
+
If your output is something other than UTF-8, you can set the RUBYOPTS
|
572
|
+
env variable to a value of '-Eutf-8'. Something like:
|
573
|
+
|
574
|
+
RUBYOPT='-Eutf-8' ruby -e 'puts Encoding.default_external'
|
575
|
+
|
576
|
+
Check your OS/shell documentation for the precise syntax (the above
|
577
|
+
will not work on a basic Windows CMD prompt, look for the SET command).
|
578
|
+
Once you've got it successfully outputing UTF-8, use the same setting
|
579
|
+
when running rake in Minitest.
|
580
|
+
|
581
|
+
=== Minitest's own tests require GNU (or similar) diff.
|
582
|
+
|
583
|
+
This is also a problem primarily affecting Windows developers. PowerShell
|
584
|
+
has a command called diff, but it is not suitable for use with Minitest.
|
585
|
+
|
586
|
+
If you see failures like either of these, you are probably missing diff tool:
|
587
|
+
|
588
|
+
4) Failure:
|
589
|
+
TestMinitestUnitTestCase#test_assert_equal_different_long [D:/ruby/seattlerb/minitest/test/minitest/test_minitest_test.rb:936]:
|
590
|
+
Expected: "--- expected\n+++ actual\n@@ -1 +1 @@\n-\"hahahahahahahahahahahahahahahahahahahaha\"\n+\"blahblahblahblahblahblahblahblahblahblah\"\n"
|
591
|
+
Actual: "Expected: \"hahahahahahahahahahahahahahahahahahahaha\"\n Actual: \"blahblahblahblahblahblahblahblahblahblah\""
|
592
|
+
|
593
|
+
|
594
|
+
5) Failure:
|
595
|
+
TestMinitestUnitTestCase#test_assert_equal_different_collection_hash_hex_invisible [D:/ruby/seattlerb/minitest/test/minitest/test_minitest_test.rb:845]:
|
596
|
+
Expected: "No visible difference in the Hash#inspect output.\nYou should look at the implementation of #== on Hash or its members.\n
|
597
|
+
{1=>#<Object:0xXXXXXX>}"
|
598
|
+
Actual: "Expected: {1=>#<Object:0x00000003ba0470>}\n Actual: {1=>#<Object:0x00000003ba0448>}"
|
599
|
+
|
600
|
+
|
601
|
+
If you use Cygwin or MSYS2 or similar there are packages that include a
|
602
|
+
GNU diff for Windows. If you don't, you can download GNU diffutils from
|
603
|
+
http://gnuwin32.sourceforge.net/packages/diffutils.htm
|
604
|
+
(make sure to add it to your PATH).
|
605
|
+
|
606
|
+
You can make sure it's installed and path is configured properly with:
|
607
|
+
|
608
|
+
diff.exe -v
|
609
|
+
|
610
|
+
There are multiple lines of output, the first should be something like:
|
611
|
+
|
612
|
+
diff (GNU diffutils) 2.8.1
|
613
|
+
|
614
|
+
If you are using PowerShell make sure you run diff.exe, not just diff,
|
615
|
+
which will invoke the PowerShell built in function.
|
616
|
+
|
617
|
+
== Known Extensions:
|
618
|
+
|
619
|
+
capybara_minitest_spec :: Bridge between Capybara RSpec matchers and
|
620
|
+
Minitest::Spec expectations (e.g.
|
621
|
+
<tt>page.must_have_content("Title")</tt>).
|
622
|
+
color_pound_spec_reporter :: Test names print Ruby Object types in color with
|
623
|
+
your Minitest Spec style tests.
|
624
|
+
minispec-metadata :: Metadata for describe/it blocks & CLI tag filter.
|
625
|
+
E.g. <tt>it "requires JS driver", js: true do</tt> &
|
626
|
+
<tt>ruby test.rb --tag js</tt> runs tests tagged :js.
|
627
|
+
minispec-rails :: Minimal support to use Spec style in Rails 5+.
|
628
|
+
mini-apivore :: for swagger based automated API testing.
|
629
|
+
minitest-around :: Around block for minitest. An alternative to
|
630
|
+
setup/teardown dance.
|
631
|
+
minitest-assert_errors :: Adds Minitest assertions to test for errors raised
|
632
|
+
or not raised by Minitest itself.
|
633
|
+
minitest-autotest :: autotest is a continuous testing facility meant to
|
634
|
+
be used during development.
|
635
|
+
minitest-bacon :: minitest-bacon extends minitest with bacon-like
|
636
|
+
functionality.
|
637
|
+
minitest-bang :: Adds support for RSpec-style let! to immediately
|
638
|
+
invoke let statements before each test.
|
639
|
+
minitest-bisect :: Helps you isolate and debug random test failures.
|
640
|
+
minitest-blink1_reporter :: Display test results with a Blink1.
|
641
|
+
minitest-capistrano :: Assertions and expectations for testing
|
642
|
+
Capistrano recipes.
|
643
|
+
minitest-capybara :: Capybara matchers support for minitest unit and
|
644
|
+
spec.
|
645
|
+
minitest-cc :: It provides minimal information about code coverage.
|
646
|
+
minitest-chef-handler :: Run Minitest suites as Chef report handlers
|
647
|
+
minitest-ci :: CI reporter plugin for Minitest.
|
648
|
+
minitest-context :: Defines contexts for code reuse in Minitest
|
649
|
+
specs that share common expectations.
|
650
|
+
minitest-debugger :: Wraps assert so failed assertions drop into
|
651
|
+
the ruby debugger.
|
652
|
+
minitest-display :: Patches Minitest to allow for an easily
|
653
|
+
configurable output.
|
654
|
+
minitest-documentation :: Minimal documentation format inspired by rspec's.
|
655
|
+
minitest-doc_reporter :: Detailed output inspired by rspec's documentation
|
656
|
+
format.
|
657
|
+
minitest-emoji :: Print out emoji for your test passes, fails, and
|
658
|
+
skips.
|
659
|
+
minitest-english :: Semantically symmetric aliases for assertions and
|
660
|
+
expectations.
|
661
|
+
minitest-excludes :: Clean API for excluding certain tests you
|
662
|
+
don't want to run under certain conditions.
|
663
|
+
minitest-fail-fast :: Reimplements RSpec's "fail fast" feature
|
664
|
+
minitest-filecontent :: Support unit tests with expectation results in files.
|
665
|
+
Differing results will be stored again in files.
|
666
|
+
minitest-filesystem :: Adds assertion and expectation to help testing
|
667
|
+
filesystem contents.
|
668
|
+
minitest-firemock :: Makes your Minitest mocks more resilient.
|
669
|
+
minitest-focus :: Focus on one test at a time.
|
670
|
+
minitest-gcstats :: A minitest plugin that adds a report of the top
|
671
|
+
tests by number of objects allocated.
|
672
|
+
minitest-global_expectations:: Support minitest expectation methods for all objects
|
673
|
+
minitest-great_expectations :: Generally useful additions to minitest's
|
674
|
+
assertions and expectations.
|
675
|
+
minitest-growl :: Test notifier for minitest via growl.
|
676
|
+
minitest-happy :: GLOBALLY ACTIVATE MINITEST PRIDE! RAWR!
|
677
|
+
minitest-have_tag :: Adds Minitest assertions to test for the existence of
|
678
|
+
HTML tags, including contents, within a provided string.
|
679
|
+
minitest-heat :: Reporting that builds a heat map of failure locations
|
680
|
+
minitest-hooks :: Around and before_all/after_all/around_all hooks
|
681
|
+
minitest-hyper :: Pretty, single-page HTML reports for your Minitest runs
|
682
|
+
minitest-implicit-subject :: Implicit declaration of the test subject.
|
683
|
+
minitest-instrument :: Instrument ActiveSupport::Notifications when
|
684
|
+
test method is executed.
|
685
|
+
minitest-instrument-db :: Store information about speed of test execution
|
686
|
+
provided by minitest-instrument in database.
|
687
|
+
minitest-junit :: JUnit-style XML reporter for minitest.
|
688
|
+
minitest-keyword :: Use Minitest assertions with keyword arguments.
|
689
|
+
minitest-libnotify :: Test notifier for minitest via libnotify.
|
690
|
+
minitest-line :: Run test at line number.
|
691
|
+
minitest-logger :: Define assert_log and enable minitest to test log messages.
|
692
|
+
Supports Logger and Log4r::Logger.
|
693
|
+
minitest-macruby :: Provides extensions to minitest for macruby UI
|
694
|
+
testing.
|
695
|
+
minitest-matchers :: Adds support for RSpec-style matchers to
|
696
|
+
minitest.
|
697
|
+
minitest-matchers_vaccine :: Adds assertions that adhere to the matcher spec,
|
698
|
+
but without any expectation infections.
|
699
|
+
minitest-metadata :: Annotate tests with metadata (key-value).
|
700
|
+
minitest-mock_expectations :: Provides method call assertions for minitest.
|
701
|
+
minitest-mongoid :: Mongoid assertion matchers for Minitest.
|
702
|
+
minitest-must_not :: Provides must_not as an alias for wont in
|
703
|
+
Minitest.
|
704
|
+
minitest-optional_retry :: Automatically retry failed test to help with flakiness.
|
705
|
+
minitest-osx :: Reporter for the Mac OS X notification center.
|
706
|
+
minitest-parallel_fork :: Fork-based parallelization
|
707
|
+
minitest-parallel-db :: Run tests in parallel with a single database.
|
708
|
+
minitest-power_assert :: PowerAssert for Minitest.
|
709
|
+
minitest-predicates :: Adds support for .predicate? methods.
|
710
|
+
minitest-profile :: List the 10 slowest tests in your suite.
|
711
|
+
minitest-rails :: Minitest integration for Rails 3.x.
|
712
|
+
minitest-rails-capybara :: Capybara integration for Minitest::Rails.
|
713
|
+
minitest-reporters :: Create customizable Minitest output formats.
|
714
|
+
minitest-rg :: Colored red/green output for Minitest.
|
715
|
+
minitest-rspec_mocks :: Use RSpec Mocks with Minitest.
|
716
|
+
minitest-server :: minitest-server provides a client/server setup
|
717
|
+
with your minitest process, allowing your test
|
718
|
+
run to send its results directly to a handler.
|
719
|
+
minitest-sequel :: Minitest assertions to speed-up development and
|
720
|
+
testing of Ruby Sequel database setups.
|
721
|
+
minitest-shared_description :: Support for shared specs and shared spec
|
722
|
+
subclasses
|
723
|
+
minitest-should_syntax :: RSpec-style <tt>x.should == y</tt> assertions for
|
724
|
+
Minitest.
|
725
|
+
minitest-shouldify :: Adding all manner of shoulds to Minitest (bad
|
726
|
+
idea)
|
727
|
+
minitest-snail :: Print a list of tests that take too long
|
728
|
+
minitest-spec-context :: Provides rspec-ish context method to
|
729
|
+
Minitest::Spec.
|
730
|
+
minitest-spec-expect :: Expect syntax for Minitest::Spec (e.g.
|
731
|
+
expect(sequences).to_include :celery_man).
|
732
|
+
minitest-spec-magic :: Minitest::Spec extensions for Rails and beyond.
|
733
|
+
minitest-spec-rails :: Drop in Minitest::Spec superclass for
|
734
|
+
ActiveSupport::TestCase.
|
735
|
+
minitest-sprint :: Runs (Get it? It's fast!) your tests and makes
|
736
|
+
it easier to rerun individual failures.
|
737
|
+
minitest-stately :: Find leaking state between tests
|
738
|
+
minitest-stub_any_instance :: Stub any instance of a method on the given class
|
739
|
+
for the duration of a block.
|
740
|
+
minitest-stub-const :: Stub constants for the duration of a block.
|
741
|
+
minitest-tags :: Add tags for minitest.
|
742
|
+
minitest-unordered :: Adds a new assertion to minitest for checking the
|
743
|
+
contents of a collection, ignoring element order.
|
744
|
+
minitest-vcr :: Automatic cassette management with Minitest::Spec
|
745
|
+
and VCR.
|
746
|
+
minitest_log :: Adds structured logging, data explication, and verdicts.
|
747
|
+
minitest_owrapper :: Get tests results as a TestResult object.
|
748
|
+
minitest_should :: Shoulda style syntax for minitest test::unit.
|
749
|
+
minitest_tu_shim :: Bridges between test/unit and minitest.
|
750
|
+
mongoid-minitest :: Minitest matchers for Mongoid.
|
751
|
+
mutant-minitest :: Minitest integration for mutant.
|
752
|
+
pry-rescue :: A pry plugin w/ minitest support. See
|
753
|
+
pry-rescue/minitest.rb.
|
754
|
+
rematch :: Declutter your test files from large hardcoded data
|
755
|
+
and update them automatically when your code changes.
|
756
|
+
rspec2minitest :: Easily translate any RSpec matchers to Minitest
|
757
|
+
assertions and expectations.
|
758
|
+
stubberry :: Multiple stubbing 'berries', sweet and useful
|
759
|
+
stub helpers and assertions. ( stub_must,
|
760
|
+
assert_method_called, stubbing ORM objects by id )
|
761
|
+
|
762
|
+
== Unknown Extensions:
|
763
|
+
|
764
|
+
Authors... Please send me a pull request with a description of your minitest extension.
|
765
|
+
|
766
|
+
* assay-minitest
|
767
|
+
* detroit-minitest
|
768
|
+
* em-minitest-spec
|
769
|
+
* flexmock-minitest
|
770
|
+
* guard-minitest
|
771
|
+
* guard-minitest-decisiv
|
772
|
+
* minitest-activemodel
|
773
|
+
* minitest-ar-assertions
|
774
|
+
* minitest-capybara-unit
|
775
|
+
* minitest-colorer
|
776
|
+
* minitest-deluxe
|
777
|
+
* minitest-extra-assertions
|
778
|
+
* minitest-rails-shoulda
|
779
|
+
* minitest-spec
|
780
|
+
* minitest-spec-should
|
781
|
+
* minitest-sugar
|
782
|
+
* spork-minitest
|
783
|
+
|
784
|
+
== Minitest related goods
|
785
|
+
|
786
|
+
* minitest/pride fabric: https://www.spoonflower.com/fabric/3928730-again-by-katie_allen
|
787
|
+
|
788
|
+
== REQUIREMENTS:
|
789
|
+
|
790
|
+
* Ruby 2.3+. No magic is involved. I hope.
|
791
|
+
|
792
|
+
== INSTALL:
|
793
|
+
|
794
|
+
sudo gem install minitest
|
795
|
+
|
796
|
+
On 1.9, you already have it. To get newer candy you can still install
|
797
|
+
the gem, and then requiring "minitest/autorun" should automatically
|
798
|
+
pull it in. If not, you'll need to do it yourself:
|
799
|
+
|
800
|
+
gem "minitest" # ensures you"re using the gem, and not the built-in MT
|
801
|
+
require "minitest/autorun"
|
802
|
+
|
803
|
+
# ... usual testing stuffs ...
|
804
|
+
|
805
|
+
DO NOTE: There is a serious problem with the way that ruby 1.9/2.0
|
806
|
+
packages their own gems. They install a gem specification file, but
|
807
|
+
don't install the gem contents in the gem path. This messes up
|
808
|
+
Gem.find_files and many other things (gem which, gem contents, etc).
|
809
|
+
|
810
|
+
Just install minitest as a gem for real and you'll be happier.
|
811
|
+
|
812
|
+
== LICENSE:
|
813
|
+
|
814
|
+
(The MIT License)
|
815
|
+
|
816
|
+
Copyright (c) Ryan Davis, seattle.rb
|
817
|
+
|
818
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
819
|
+
a copy of this software and associated documentation files (the
|
820
|
+
'Software'), to deal in the Software without restriction, including
|
821
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
822
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
823
|
+
permit persons to whom the Software is furnished to do so, subject to
|
824
|
+
the following conditions:
|
825
|
+
|
826
|
+
The above copyright notice and this permission notice shall be
|
827
|
+
included in all copies or substantial portions of the Software.
|
828
|
+
|
829
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
830
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
831
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
832
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
833
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
834
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
835
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|