orthoses-rails 0.1.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (107) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +39 -0
  3. data/examples/rails/Rakefile +373 -0
  4. data/examples/rails/known_sig/action_cable/connection/test_cookie_jar.rbs +2 -0
  5. data/examples/rails/known_sig/action_controller/metal.rbs +4 -0
  6. data/examples/rails/known_sig/action_dispatch/cookies/cookie_jar.rbs +3 -0
  7. data/examples/rails/known_sig/action_dispatch/response.rbs +4 -0
  8. data/examples/rails/patch/drb/drb_undumped.rbs +2 -0
  9. data/examples/rails/patch/drb.rbs +2 -0
  10. data/examples/rails/patch/erubi/engine.rbs +4 -0
  11. data/examples/rails/patch/erubi.rbs +2 -0
  12. data/examples/rails/patch/minitest/kernel.rbs +44 -0
  13. data/examples/rails/patch/minitest/minitest/abstract_reporter.rbs +49 -0
  14. data/examples/rails/patch/minitest/minitest/assertion.rbs +16 -0
  15. data/examples/rails/patch/minitest/minitest/assertions.rbs +545 -0
  16. data/examples/rails/patch/minitest/minitest/backtrace_filter.rbs +16 -0
  17. data/examples/rails/patch/minitest/minitest/bench_spec.rbs +101 -0
  18. data/examples/rails/patch/minitest/minitest/benchmark.rbs +258 -0
  19. data/examples/rails/patch/minitest/minitest/composite_reporter.rbs +25 -0
  20. data/examples/rails/patch/minitest/minitest/expectations.rbs +21 -0
  21. data/examples/rails/patch/minitest/minitest/guard.rbs +64 -0
  22. data/examples/rails/patch/minitest/minitest/mock.rbs +60 -0
  23. data/examples/rails/patch/minitest/minitest/parallel/executor.rbs +42 -0
  24. data/examples/rails/patch/minitest/minitest/parallel/test/class_methods.rbs +6 -0
  25. data/examples/rails/patch/minitest/minitest/parallel/test.rbs +3 -0
  26. data/examples/rails/patch/minitest/minitest/parallel.rbs +2 -0
  27. data/examples/rails/patch/minitest/minitest/pride_io.rbs +54 -0
  28. data/examples/rails/patch/minitest/minitest/pride_lol.rbs +17 -0
  29. data/examples/rails/patch/minitest/minitest/progress_reporter.rbs +11 -0
  30. data/examples/rails/patch/minitest/minitest/reportable.rbs +51 -0
  31. data/examples/rails/patch/minitest/minitest/reporter.rbs +5 -0
  32. data/examples/rails/patch/minitest/minitest/result.rbs +28 -0
  33. data/examples/rails/patch/minitest/minitest/runnable.rbs +131 -0
  34. data/examples/rails/patch/minitest/minitest/skip.rbs +6 -0
  35. data/examples/rails/patch/minitest/minitest/spec/dsl/instance_methods.rbs +48 -0
  36. data/examples/rails/patch/minitest/minitest/spec/dsl.rbs +125 -0
  37. data/examples/rails/patch/minitest/minitest/spec.rbs +10 -0
  38. data/examples/rails/patch/minitest/minitest/statistics_reporter.rbs +76 -0
  39. data/examples/rails/patch/minitest/minitest/summary_reporter.rbs +26 -0
  40. data/examples/rails/patch/minitest/minitest/test/lifecycle_hooks.rbs +92 -0
  41. data/examples/rails/patch/minitest/minitest/test.rbs +76 -0
  42. data/examples/rails/patch/minitest/minitest/unexpected_error.rbs +10 -0
  43. data/examples/rails/patch/minitest/minitest/unit/test_case.rbs +3 -0
  44. data/examples/rails/patch/minitest/minitest/unit.rbs +5 -0
  45. data/examples/rails/patch/minitest/minitest.rbs +966 -0
  46. data/examples/rails/patch/pg/simple_decoder.rbs +4 -0
  47. data/examples/rails/patch/pg.rbs +2 -0
  48. data/examples/rails/patch/qc/queue.rbs +2 -0
  49. data/examples/rails/patch/qc.rbs +2 -0
  50. data/examples/rails/patch/que/job.rbs +2 -0
  51. data/examples/rails/patch/que.rbs +2 -0
  52. data/examples/rails/patch/rack/cache/entity_store.rbs +2 -0
  53. data/examples/rails/patch/rack/cache/meta_store.rbs +2 -0
  54. data/examples/rails/patch/rack/cache.rbs +2 -0
  55. data/examples/rails/patch/rack/session/dalli.rbs +2 -0
  56. data/examples/rails/patch/rack/session.rbs +2 -0
  57. data/examples/rails/patch/rboc.rbs +2 -0
  58. data/examples/rails/patch/rdoc/generator/sdoc.rbs +3 -0
  59. data/examples/rails/patch/rdoc/generator.rbs +2 -0
  60. data/examples/rails/patch/rdoc/task.rbs +2 -0
  61. data/examples/rails/patch/ripper.rbs +2 -0
  62. data/examples/rails/patch/sidekiq/worker.rbs +2 -0
  63. data/examples/rails/patch/sidekiq.rbs +2 -0
  64. data/examples/rails/patch/sneakers/worker.rbs +2 -0
  65. data/examples/rails/patch/sneakers.rbs +2 -0
  66. data/examples/rails/patch/sucker_punch/job.rbs +2 -0
  67. data/examples/rails/patch/sucker_punch.rbs +2 -0
  68. data/examples/rails/patch/thor/actions/create_file.rbs +2 -0
  69. data/examples/rails/patch/thor/actions.rbs +2 -0
  70. data/examples/rails/patch/thor/error.rbs +2 -0
  71. data/examples/rails/patch/thor/group.rbs +2 -0
  72. data/examples/rails/patch/thor.rbs +2 -0
  73. data/lib/orthoses/active_model/has_secure_password.rb +24 -13
  74. data/lib/orthoses/active_model/known_sig/7.0/serialization.rbs +4 -0
  75. data/lib/orthoses/active_model/known_sig/7.0/validations.rbs +4 -0
  76. data/lib/orthoses/active_model/known_sig.rb +21 -0
  77. data/lib/orthoses/active_model.rb +4 -0
  78. data/lib/orthoses/active_record/belongs_to.rb +10 -4
  79. data/lib/orthoses/active_record/generated_attribute_methods.rb +6 -4
  80. data/lib/orthoses/active_record/has_many.rb +6 -6
  81. data/lib/orthoses/active_record/has_one.rb +5 -4
  82. data/lib/orthoses/active_record/known_sig/6.0/result.rbs +5 -0
  83. data/lib/orthoses/active_record/known_sig/6.1/result.rbs +5 -0
  84. data/lib/orthoses/active_record/known_sig/7.0/encryption/context.rbs +9 -0
  85. data/lib/orthoses/active_record/known_sig/7.0/result.rbs +5 -0
  86. data/lib/orthoses/active_record/known_sig.rb +21 -0
  87. data/lib/orthoses/active_record/query_methods.rb +32 -0
  88. data/lib/orthoses/active_record.rb +8 -0
  89. data/lib/orthoses/active_support/class_attribute.rb +30 -17
  90. data/lib/orthoses/active_support/configurable.rb +36 -0
  91. data/lib/orthoses/active_support/delegation.rb +158 -0
  92. data/lib/orthoses/active_support/known_sig/7.0/active_support/callbacks/callback_chain.rbs +9 -0
  93. data/lib/orthoses/active_support/known_sig/7.0/active_support/hash_with_indifferent_access.rbs +6 -0
  94. data/lib/orthoses/active_support/known_sig/7.0/active_support/multibyte/chars.rbs +7 -0
  95. data/lib/orthoses/active_support/known_sig/7.0/hash_with_indifferent_access.rbs +2 -0
  96. data/lib/orthoses/active_support/known_sig/{time.rbs → 7.0/time.rbs} +4 -0
  97. data/lib/orthoses/active_support/known_sig.rb +21 -0
  98. data/lib/orthoses/active_support/mattr_accessor.rb +21 -14
  99. data/lib/orthoses/active_support/time_with_zone.rb +13 -15
  100. data/lib/orthoses/active_support.rb +24 -0
  101. data/lib/orthoses/rails/known_sig_helper.rb +22 -0
  102. data/lib/orthoses/rails/version.rb +1 -1
  103. data/lib/orthoses/rails.rb +4 -11
  104. data/orthoses-rails.gemspec +2 -2
  105. metadata +97 -9
  106. data/lib/orthoses/active_support/concern.rb +0 -22
  107. data/lib/orthoses/active_support/known_sig/active_support/time_with_zone.rbs +0 -4
@@ -0,0 +1,545 @@
1
+ # <!-- rdoc-file=lib/minitest/assertions.rb -->
2
+ # Minitest Assertions. All assertion methods accept a `msg` which is printed if
3
+ # the assertion fails.
4
+ #
5
+ # Protocol: Nearly everything here boils up to `assert`, which expects to be
6
+ # able to increment an instance accessor named `assertions`. This is not
7
+ # provided by Assertions and must be provided by the thing including Assertions.
8
+ # See Minitest::Runnable for an example.
9
+ #
10
+ module Minitest::Assertions
11
+ def self.inspect: () -> "UNDEFINED"
12
+
13
+ # <!--
14
+ # rdoc-file=lib/minitest/assertions.rb
15
+ # - diff()
16
+ # -->
17
+ # Returns the diff command to use in #diff. Tries to intelligently figure out
18
+ # what diff to use.
19
+ #
20
+ def self.diff: () -> untyped
21
+
22
+ # <!--
23
+ # rdoc-file=lib/minitest/assertions.rb
24
+ # - diff=(o)
25
+ # -->
26
+ # Set the diff command to use in #diff.
27
+ #
28
+ def self.diff=: (untyped o) -> untyped
29
+
30
+ # <!--
31
+ # rdoc-file=lib/minitest/assertions.rb
32
+ # - diff(exp, act)
33
+ # -->
34
+ # Returns a diff between `exp` and `act`. If there is no known diff command or
35
+ # if it doesn't make sense to diff the output (single line, short output), then
36
+ # it simply returns a basic comparison between the two.
37
+ #
38
+ # See `things_to_diff` for more info.
39
+ #
40
+ def diff: (untyped exp, untyped act) -> (::String | untyped)
41
+
42
+ # <!--
43
+ # rdoc-file=lib/minitest/assertions.rb
44
+ # - things_to_diff(exp, act)
45
+ # -->
46
+ # Returns things to diff [expect, butwas], or [nil, nil] if nothing to diff.
47
+ #
48
+ # Criterion:
49
+ #
50
+ # 1. Strings include newlines or escaped newlines, but not both.
51
+ # 2. or: String lengths are > 30 characters.
52
+ # 3. or: Strings are equal to each other (but maybe different encodings?).
53
+ # 4. and: we found a diff executable.
54
+ #
55
+ def things_to_diff: (untyped exp, untyped act) -> untyped
56
+
57
+ # <!--
58
+ # rdoc-file=lib/minitest/assertions.rb
59
+ # - mu_pp(obj)
60
+ # -->
61
+ # This returns a human-readable version of `obj`. By default #inspect is called.
62
+ # You can override this to use #pretty_inspect if you want.
63
+ #
64
+ # See Minitest::Test.make_my_diffs_pretty!
65
+ #
66
+ def mu_pp: (untyped obj) -> untyped
67
+
68
+ # <!--
69
+ # rdoc-file=lib/minitest/assertions.rb
70
+ # - mu_pp_for_diff(obj)
71
+ # -->
72
+ # This returns a diff-able more human-readable version of `obj`. This differs
73
+ # from the regular mu_pp because it expands escaped newlines and makes
74
+ # hex-values (like object_ids) generic. This uses mu_pp to do the first pass and
75
+ # then cleans it up.
76
+ #
77
+ def mu_pp_for_diff: (untyped obj) -> untyped
78
+
79
+ # <!--
80
+ # rdoc-file=lib/minitest/assertions.rb
81
+ # - assert(test, msg = nil)
82
+ # -->
83
+ # Fails unless `test` is truthy.
84
+ #
85
+ def assert: (untyped test, ?untyped? msg) -> true
86
+
87
+ def _synchronize: () { () -> untyped } -> untyped
88
+
89
+ # <!--
90
+ # rdoc-file=lib/minitest/assertions.rb
91
+ # - assert_empty(obj, msg = nil)
92
+ # -->
93
+ # Fails unless `obj` is empty.
94
+ #
95
+ def assert_empty: (untyped obj, ?untyped? msg) -> untyped
96
+
97
+ # <!--
98
+ # rdoc-file=lib/minitest/assertions.rb
99
+ # - assert_equal(exp, act, msg = nil)
100
+ # -->
101
+ # Fails unless `exp == act` printing the difference between the two, if
102
+ # possible.
103
+ #
104
+ # If there is no visible difference but the assertion fails, you should suspect
105
+ # that your #== is buggy, or your inspect output is missing crucial details.
106
+ # For nicer structural diffing, set Minitest::Test.make_my_diffs_pretty!
107
+ #
108
+ # For floats use assert_in_delta.
109
+ #
110
+ # See also: Minitest::Assertions.diff
111
+ #
112
+ def assert_equal: (untyped exp, untyped act, ?untyped? msg) -> untyped
113
+
114
+ # <!--
115
+ # rdoc-file=lib/minitest/assertions.rb
116
+ # - assert_in_delta(exp, act, delta = 0.001, msg = nil)
117
+ # -->
118
+ # For comparing Floats. Fails unless `exp` and `act` are within `delta` of each
119
+ # other.
120
+ #
121
+ # assert_in_delta Math::PI, (22.0 / 7.0), 0.01
122
+ #
123
+ def assert_in_delta: (untyped exp, untyped act, ?::Float delta, ?untyped? msg) -> untyped
124
+
125
+ # <!--
126
+ # rdoc-file=lib/minitest/assertions.rb
127
+ # - assert_in_epsilon(exp, act, epsilon = 0.001, msg = nil)
128
+ # -->
129
+ # For comparing Floats. Fails unless `exp` and `act` have a relative error less
130
+ # than `epsilon`.
131
+ #
132
+ def assert_in_epsilon: (untyped exp, untyped act, ?::Float epsilon, ?untyped? msg) -> untyped
133
+
134
+ # <!--
135
+ # rdoc-file=lib/minitest/assertions.rb
136
+ # - assert_includes(collection, obj, msg = nil)
137
+ # -->
138
+ # Fails unless `collection` includes `obj`.
139
+ #
140
+ def assert_includes: (untyped collection, untyped obj, ?untyped? msg) -> untyped
141
+
142
+ # <!--
143
+ # rdoc-file=lib/minitest/assertions.rb
144
+ # - assert_instance_of(cls, obj, msg = nil)
145
+ # -->
146
+ # Fails unless `obj` is an instance of `cls`.
147
+ #
148
+ def assert_instance_of: (untyped cls, untyped obj, ?untyped? msg) -> untyped
149
+
150
+ # <!--
151
+ # rdoc-file=lib/minitest/assertions.rb
152
+ # - assert_kind_of(cls, obj, msg = nil)
153
+ # -->
154
+ # Fails unless `obj` is a kind of `cls`.
155
+ #
156
+ def assert_kind_of: (untyped cls, untyped obj, ?untyped? msg) -> untyped
157
+
158
+ # <!--
159
+ # rdoc-file=lib/minitest/assertions.rb
160
+ # - assert_match(matcher, obj, msg = nil)
161
+ # -->
162
+ # Fails unless `matcher` `=~` `obj`.
163
+ #
164
+ def assert_match: (untyped matcher, untyped obj, ?untyped? msg) -> untyped
165
+
166
+ # <!--
167
+ # rdoc-file=lib/minitest/assertions.rb
168
+ # - assert_nil(obj, msg = nil)
169
+ # -->
170
+ # Fails unless `obj` is nil
171
+ #
172
+ def assert_nil: (untyped obj, ?untyped? msg) -> untyped
173
+
174
+ # <!--
175
+ # rdoc-file=lib/minitest/assertions.rb
176
+ # - assert_operator(o1, op, o2 = UNDEFINED, msg = nil)
177
+ # -->
178
+ # For testing with binary operators. Eg:
179
+ #
180
+ # assert_operator 5, :<=, 4
181
+ #
182
+ def assert_operator: (untyped o1, untyped op, ?untyped o2, ?untyped? msg) -> untyped
183
+
184
+ # <!--
185
+ # rdoc-file=lib/minitest/assertions.rb
186
+ # - assert_output(stdout = nil, stderr = nil) { || ... }
187
+ # -->
188
+ # Fails if stdout or stderr do not output the expected results. Pass in nil if
189
+ # you don't care about that streams output. Pass in "" if you require it to be
190
+ # silent. Pass in a regexp if you want to pattern match.
191
+ #
192
+ # assert_output(/hey/) { method_with_output }
193
+ #
194
+ # NOTE: this uses #capture_io, not #capture_subprocess_io.
195
+ #
196
+ # See also: #assert_silent
197
+ #
198
+ def assert_output: (?untyped? stdout, ?untyped? stderr) { () -> untyped } -> untyped
199
+
200
+ # <!--
201
+ # rdoc-file=lib/minitest/assertions.rb
202
+ # - assert_path_exists(path, msg = nil)
203
+ # -->
204
+ # Fails unless `path` exists.
205
+ #
206
+ def assert_path_exists: (untyped path, ?untyped? msg) -> untyped
207
+
208
+ # <!--
209
+ # rdoc-file=lib/minitest/assertions.rb
210
+ # - assert_predicate(o1, op, msg = nil)
211
+ # -->
212
+ # For testing with predicates. Eg:
213
+ #
214
+ # assert_predicate str, :empty?
215
+ #
216
+ # This is really meant for specs and is front-ended by assert_operator:
217
+ #
218
+ # str.must_be :empty?
219
+ #
220
+ def assert_predicate: (untyped o1, untyped op, ?untyped? msg) -> untyped
221
+
222
+ # <!--
223
+ # rdoc-file=lib/minitest/assertions.rb
224
+ # - assert_raises(*exp) { || ... }
225
+ # -->
226
+ # Fails unless the block raises one of `exp`. Returns the exception matched so
227
+ # you can check the message, attributes, etc.
228
+ #
229
+ # `exp` takes an optional message on the end to help explain failures and
230
+ # defaults to StandardError if no exception class is passed. Eg:
231
+ #
232
+ # assert_raises(CustomError) { method_with_custom_error }
233
+ #
234
+ # With custom error message:
235
+ #
236
+ # assert_raises(CustomError, 'This should have raised CustomError') { method_with_custom_error }
237
+ #
238
+ # Using the returned object:
239
+ #
240
+ # error = assert_raises(CustomError) do
241
+ # raise CustomError, 'This is really bad'
242
+ # end
243
+ #
244
+ # assert_equal 'This is really bad', error.message
245
+ #
246
+ def assert_raises: (*untyped exp) { () -> untyped } -> untyped
247
+
248
+ # <!--
249
+ # rdoc-file=lib/minitest/assertions.rb
250
+ # - assert_respond_to(obj, meth, msg = nil)
251
+ # -->
252
+ # Fails unless `obj` responds to `meth`.
253
+ #
254
+ def assert_respond_to: (untyped obj, untyped meth, ?untyped? msg) -> untyped
255
+
256
+ # <!--
257
+ # rdoc-file=lib/minitest/assertions.rb
258
+ # - assert_same(exp, act, msg = nil)
259
+ # -->
260
+ # Fails unless `exp` and `act` are #equal?
261
+ #
262
+ def assert_same: (untyped exp, untyped act, ?untyped? msg) -> untyped
263
+
264
+ # <!--
265
+ # rdoc-file=lib/minitest/assertions.rb
266
+ # - assert_send(send_ary, m = nil)
267
+ # -->
268
+ # `send_ary` is a receiver, message and arguments.
269
+ #
270
+ # Fails unless the call returns a true value
271
+ #
272
+ def assert_send: (untyped send_ary, ?untyped? m) -> untyped
273
+
274
+ # <!--
275
+ # rdoc-file=lib/minitest/assertions.rb
276
+ # - assert_silent() { || ... }
277
+ # -->
278
+ # Fails if the block outputs anything to stderr or stdout.
279
+ #
280
+ # See also: #assert_output
281
+ #
282
+ def assert_silent: () { () -> untyped } -> untyped
283
+
284
+ # <!--
285
+ # rdoc-file=lib/minitest/assertions.rb
286
+ # - assert_throws(sym, msg = nil) { || ... }
287
+ # -->
288
+ # Fails unless the block throws `sym`
289
+ #
290
+ def assert_throws: (untyped sym, ?untyped? msg) { () -> untyped } -> untyped
291
+
292
+ # <!--
293
+ # rdoc-file=lib/minitest/assertions.rb
294
+ # - capture_io() { || ... }
295
+ # -->
296
+ # Captures $stdout and $stderr into strings:
297
+ #
298
+ # out, err = capture_io do
299
+ # puts "Some info"
300
+ # warn "You did a bad thing"
301
+ # end
302
+ #
303
+ # assert_match %r%info%, out
304
+ # assert_match %r%bad%, err
305
+ #
306
+ # NOTE: For efficiency, this method uses StringIO and does not capture IO for
307
+ # subprocesses. Use #capture_subprocess_io for that.
308
+ #
309
+ def capture_io: () { () -> untyped } -> untyped
310
+
311
+ # <!--
312
+ # rdoc-file=lib/minitest/assertions.rb
313
+ # - capture_subprocess_io() { || ... }
314
+ # -->
315
+ # Captures $stdout and $stderr into strings, using Tempfile to ensure that
316
+ # subprocess IO is captured as well.
317
+ #
318
+ # out, err = capture_subprocess_io do
319
+ # system "echo Some info"
320
+ # system "echo You did a bad thing 1>&2"
321
+ # end
322
+ #
323
+ # assert_match %r%info%, out
324
+ # assert_match %r%bad%, err
325
+ #
326
+ # NOTE: This method is approximately 10x slower than #capture_io so only use it
327
+ # when you need to test the output of a subprocess.
328
+ #
329
+ def capture_subprocess_io: () { () -> untyped } -> untyped
330
+
331
+ # <!--
332
+ # rdoc-file=lib/minitest/assertions.rb
333
+ # - exception_details(e, msg)
334
+ # -->
335
+ # Returns details for exception `e`
336
+ #
337
+ def exception_details: (untyped e, untyped msg) -> untyped
338
+
339
+ # <!--
340
+ # rdoc-file=lib/minitest/assertions.rb
341
+ # - fail_after(y,m,d,msg)
342
+ # -->
343
+ # Fails after a given date (in the local time zone). This allows you to put
344
+ # time-bombs in your tests if you need to keep something around until a later
345
+ # date lest you forget about it.
346
+ #
347
+ def fail_after: (untyped y, untyped m, untyped d, untyped msg) -> (untyped | nil)
348
+
349
+ # <!--
350
+ # rdoc-file=lib/minitest/assertions.rb
351
+ # - flunk(msg = nil)
352
+ # -->
353
+ # Fails with `msg`.
354
+ #
355
+ def flunk: (?untyped? msg) -> untyped
356
+
357
+ # <!--
358
+ # rdoc-file=lib/minitest/assertions.rb
359
+ # - message(msg = nil, ending = nil, &default)
360
+ # -->
361
+ # Returns a proc that will output `msg` along with the default message.
362
+ #
363
+ def message: (?untyped? msg, ?untyped? ending) { () -> untyped } -> untyped
364
+
365
+ # <!--
366
+ # rdoc-file=lib/minitest/assertions.rb
367
+ # - pass(_msg = nil)
368
+ # -->
369
+ # used for counting assertions
370
+ #
371
+ def pass: (?untyped? _msg) -> untyped
372
+
373
+ # <!--
374
+ # rdoc-file=lib/minitest/assertions.rb
375
+ # - refute(test, msg = nil)
376
+ # -->
377
+ # Fails if `test` is truthy.
378
+ #
379
+ def refute: (untyped test, ?untyped? msg) -> untyped
380
+
381
+ # <!--
382
+ # rdoc-file=lib/minitest/assertions.rb
383
+ # - refute_empty(obj, msg = nil)
384
+ # -->
385
+ # Fails if `obj` is empty.
386
+ #
387
+ def refute_empty: (untyped obj, ?untyped? msg) -> untyped
388
+
389
+ # <!--
390
+ # rdoc-file=lib/minitest/assertions.rb
391
+ # - refute_equal(exp, act, msg = nil)
392
+ # -->
393
+ # Fails if `exp == act`.
394
+ #
395
+ # For floats use refute_in_delta.
396
+ #
397
+ def refute_equal: (untyped exp, untyped act, ?untyped? msg) -> untyped
398
+
399
+ # <!--
400
+ # rdoc-file=lib/minitest/assertions.rb
401
+ # - refute_in_delta(exp, act, delta = 0.001, msg = nil)
402
+ # -->
403
+ # For comparing Floats. Fails if `exp` is within `delta` of `act`.
404
+ #
405
+ # refute_in_delta Math::PI, (22.0 / 7.0)
406
+ #
407
+ def refute_in_delta: (untyped exp, untyped act, ?::Float delta, ?untyped? msg) -> untyped
408
+
409
+ # <!--
410
+ # rdoc-file=lib/minitest/assertions.rb
411
+ # - refute_in_epsilon(a, b, epsilon = 0.001, msg = nil)
412
+ # -->
413
+ # For comparing Floats. Fails if `exp` and `act` have a relative error less
414
+ # than `epsilon`.
415
+ #
416
+ def refute_in_epsilon: (untyped a, untyped b, ?::Float epsilon, ?untyped? msg) -> untyped
417
+
418
+ # <!--
419
+ # rdoc-file=lib/minitest/assertions.rb
420
+ # - refute_includes(collection, obj, msg = nil)
421
+ # -->
422
+ # Fails if `collection` includes `obj`.
423
+ #
424
+ def refute_includes: (untyped collection, untyped obj, ?untyped? msg) -> untyped
425
+
426
+ # <!--
427
+ # rdoc-file=lib/minitest/assertions.rb
428
+ # - refute_instance_of(cls, obj, msg = nil)
429
+ # -->
430
+ # Fails if `obj` is an instance of `cls`.
431
+ #
432
+ def refute_instance_of: (untyped cls, untyped obj, ?untyped? msg) -> untyped
433
+
434
+ # <!--
435
+ # rdoc-file=lib/minitest/assertions.rb
436
+ # - refute_kind_of(cls, obj, msg = nil)
437
+ # -->
438
+ # Fails if `obj` is a kind of `cls`.
439
+ #
440
+ def refute_kind_of: (untyped cls, untyped obj, ?untyped? msg) -> untyped
441
+
442
+ # <!--
443
+ # rdoc-file=lib/minitest/assertions.rb
444
+ # - refute_match(matcher, obj, msg = nil)
445
+ # -->
446
+ # Fails if `matcher` `=~` `obj`.
447
+ #
448
+ def refute_match: (untyped matcher, untyped obj, ?untyped? msg) -> untyped
449
+
450
+ # <!--
451
+ # rdoc-file=lib/minitest/assertions.rb
452
+ # - refute_nil(obj, msg = nil)
453
+ # -->
454
+ # Fails if `obj` is nil.
455
+ #
456
+ def refute_nil: (untyped obj, ?untyped? msg) -> untyped
457
+
458
+ # <!--
459
+ # rdoc-file=lib/minitest/assertions.rb
460
+ # - refute_operator(o1, op, o2 = UNDEFINED, msg = nil)
461
+ # -->
462
+ # Fails if `o1` is not `op` `o2`. Eg:
463
+ #
464
+ # refute_operator 1, :>, 2 #=> pass
465
+ # refute_operator 1, :<, 2 #=> fail
466
+ #
467
+ def refute_operator: (untyped o1, untyped op, ?untyped o2, ?untyped? msg) -> untyped
468
+
469
+ # <!--
470
+ # rdoc-file=lib/minitest/assertions.rb
471
+ # - refute_path_exists(path, msg = nil)
472
+ # -->
473
+ # Fails if `path` exists.
474
+ #
475
+ def refute_path_exists: (untyped path, ?untyped? msg) -> untyped
476
+
477
+ # <!--
478
+ # rdoc-file=lib/minitest/assertions.rb
479
+ # - refute_predicate(o1, op, msg = nil)
480
+ # -->
481
+ # For testing with predicates.
482
+ #
483
+ # refute_predicate str, :empty?
484
+ #
485
+ # This is really meant for specs and is front-ended by refute_operator:
486
+ #
487
+ # str.wont_be :empty?
488
+ #
489
+ def refute_predicate: (untyped o1, untyped op, ?untyped? msg) -> untyped
490
+
491
+ # <!--
492
+ # rdoc-file=lib/minitest/assertions.rb
493
+ # - refute_respond_to(obj, meth, msg = nil)
494
+ # -->
495
+ # Fails if `obj` responds to the message `meth`.
496
+ #
497
+ def refute_respond_to: (untyped obj, untyped meth, ?untyped? msg) -> untyped
498
+
499
+ # <!--
500
+ # rdoc-file=lib/minitest/assertions.rb
501
+ # - refute_same(exp, act, msg = nil)
502
+ # -->
503
+ # Fails if `exp` is the same (by object identity) as `act`.
504
+ #
505
+ def refute_same: (untyped exp, untyped act, ?untyped? msg) -> untyped
506
+
507
+ # <!--
508
+ # rdoc-file=lib/minitest/assertions.rb
509
+ # - skip(msg = nil, bt = caller)
510
+ # -->
511
+ # Skips the current run. If run in verbose-mode, the skipped run gets listed at
512
+ # the end of the run but doesn't cause a failure exit code.
513
+ #
514
+ def skip: (?untyped? msg, ?untyped bt) -> untyped
515
+
516
+ # <!--
517
+ # rdoc-file=lib/minitest/assertions.rb
518
+ # - skip_until(y,m,d,msg)
519
+ # -->
520
+ # Skips the current run until a given date (in the local time zone). This allows
521
+ # you to put some fixes on hold until a later date, but still holds you
522
+ # accountable and prevents you from forgetting it.
523
+ #
524
+ def skip_until: (untyped y, untyped m, untyped d, untyped msg) -> untyped
525
+
526
+ # <!--
527
+ # rdoc-file=lib/minitest/assertions.rb
528
+ # - skipped?()
529
+ # -->
530
+ # Was this testcase skipped? Meant for #teardown.
531
+ #
532
+ def skipped?: () -> untyped
533
+
534
+ # <!--
535
+ # rdoc-file=lib/minitest/mock.rb
536
+ # - assert_mock(mock)
537
+ # -->
538
+ # Assert that the mock verifies correctly.
539
+ #
540
+ def assert_mock: (untyped mock) -> untyped
541
+
542
+ E: String
543
+
544
+ UNDEFINED: Object
545
+ end
@@ -0,0 +1,16 @@
1
+ # <!-- rdoc-file=lib/minitest.rb -->
2
+ # The standard backtrace filter for minitest.
3
+ #
4
+ # See Minitest.backtrace_filter=.
5
+ #
6
+ class Minitest::BacktraceFilter
7
+ # <!--
8
+ # rdoc-file=lib/minitest.rb
9
+ # - filter(bt)
10
+ # -->
11
+ # Filter `bt` to something useful. Returns the whole thing if $DEBUG (ruby) or
12
+ # $MT_DEBUG (env).
13
+ #
14
+ def filter: (untyped bt) -> (::Array["No backtrace"] | untyped)
15
+ MT_RE: Regexp
16
+ end
@@ -0,0 +1,101 @@
1
+ # <!-- rdoc-file=lib/minitest/benchmark.rb -->
2
+ # The spec version of Minitest::Benchmark.
3
+ #
4
+ class Minitest::BenchSpec < ::Minitest::Benchmark
5
+ # <!--
6
+ # rdoc-file=lib/minitest/benchmark.rb
7
+ # - bench(name, &block)
8
+ # -->
9
+ # This is used to define a new benchmark method. You usually don't use this
10
+ # directly and is intended for those needing to write new performance curve fits
11
+ # (eg: you need a specific polynomial fit).
12
+ #
13
+ # See ::bench_performance_linear for an example of how to use this.
14
+ #
15
+ def self.bench: (untyped name) { () -> untyped } -> untyped
16
+
17
+ # <!--
18
+ # rdoc-file=lib/minitest/benchmark.rb
19
+ # - bench_range(&block)
20
+ # -->
21
+ # Specifies the ranges used for benchmarking for that class.
22
+ #
23
+ # bench_range do
24
+ # bench_exp(2, 16, 2)
25
+ # end
26
+ #
27
+ # See Minitest::Benchmark#bench_range for more details.
28
+ #
29
+ def self.bench_range: () { () -> untyped } -> untyped
30
+
31
+ # <!--
32
+ # rdoc-file=lib/minitest/benchmark.rb
33
+ # - bench_performance_linear(name, threshold = 0.99, &work)
34
+ # -->
35
+ # Create a benchmark that verifies that the performance is linear.
36
+ #
37
+ # describe "my class Bench" do
38
+ # bench_performance_linear "fast_algorithm", 0.9999 do |n|
39
+ # @obj.fast_algorithm(n)
40
+ # end
41
+ # end
42
+ #
43
+ def self.bench_performance_linear: (untyped name, ?::Float threshold) { () -> untyped } -> untyped
44
+
45
+ # <!--
46
+ # rdoc-file=lib/minitest/benchmark.rb
47
+ # - bench_performance_constant(name, threshold = 0.99, &work)
48
+ # -->
49
+ # Create a benchmark that verifies that the performance is constant.
50
+ #
51
+ # describe "my class Bench" do
52
+ # bench_performance_constant "zoom_algorithm!" do |n|
53
+ # @obj.zoom_algorithm!(n)
54
+ # end
55
+ # end
56
+ #
57
+ def self.bench_performance_constant: (untyped name, ?::Float threshold) { () -> untyped } -> untyped
58
+
59
+ # <!--
60
+ # rdoc-file=lib/minitest/benchmark.rb
61
+ # - bench_performance_exponential(name, threshold = 0.99, &work)
62
+ # -->
63
+ # Create a benchmark that verifies that the performance is exponential.
64
+ #
65
+ # describe "my class Bench" do
66
+ # bench_performance_exponential "algorithm" do |n|
67
+ # @obj.algorithm(n)
68
+ # end
69
+ # end
70
+ #
71
+ def self.bench_performance_exponential: (untyped name, ?::Float threshold) { () -> untyped } -> untyped
72
+
73
+ # <!--
74
+ # rdoc-file=lib/minitest/benchmark.rb
75
+ # - bench_performance_logarithmic(name, threshold = 0.99, &work)
76
+ # -->
77
+ # Create a benchmark that verifies that the performance is logarithmic.
78
+ #
79
+ # describe "my class Bench" do
80
+ # bench_performance_logarithmic "algorithm" do |n|
81
+ # @obj.algorithm(n)
82
+ # end
83
+ # end
84
+ #
85
+ def self.bench_performance_logarithmic: (untyped name, ?::Float threshold) { () -> untyped } -> untyped
86
+
87
+ # <!--
88
+ # rdoc-file=lib/minitest/benchmark.rb
89
+ # - bench_performance_power(name, threshold = 0.99, &work)
90
+ # -->
91
+ # Create a benchmark that verifies that the performance is power.
92
+ #
93
+ # describe "my class Bench" do
94
+ # bench_performance_power "algorithm" do |n|
95
+ # @obj.algorithm(n)
96
+ # end
97
+ # end
98
+ #
99
+ def self.bench_performance_power: (untyped name, ?::Float threshold) { () -> untyped } -> untyped
100
+ include Minitest::Spec::DSL::InstanceMethods
101
+ end