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.
- checksums.yaml +4 -4
- data/README.md +39 -0
- data/examples/rails/Rakefile +373 -0
- data/examples/rails/known_sig/action_cable/connection/test_cookie_jar.rbs +2 -0
- data/examples/rails/known_sig/action_controller/metal.rbs +4 -0
- data/examples/rails/known_sig/action_dispatch/cookies/cookie_jar.rbs +3 -0
- data/examples/rails/known_sig/action_dispatch/response.rbs +4 -0
- data/examples/rails/patch/drb/drb_undumped.rbs +2 -0
- data/examples/rails/patch/drb.rbs +2 -0
- data/examples/rails/patch/erubi/engine.rbs +4 -0
- data/examples/rails/patch/erubi.rbs +2 -0
- data/examples/rails/patch/minitest/kernel.rbs +44 -0
- data/examples/rails/patch/minitest/minitest/abstract_reporter.rbs +49 -0
- data/examples/rails/patch/minitest/minitest/assertion.rbs +16 -0
- data/examples/rails/patch/minitest/minitest/assertions.rbs +545 -0
- data/examples/rails/patch/minitest/minitest/backtrace_filter.rbs +16 -0
- data/examples/rails/patch/minitest/minitest/bench_spec.rbs +101 -0
- data/examples/rails/patch/minitest/minitest/benchmark.rbs +258 -0
- data/examples/rails/patch/minitest/minitest/composite_reporter.rbs +25 -0
- data/examples/rails/patch/minitest/minitest/expectations.rbs +21 -0
- data/examples/rails/patch/minitest/minitest/guard.rbs +64 -0
- data/examples/rails/patch/minitest/minitest/mock.rbs +60 -0
- data/examples/rails/patch/minitest/minitest/parallel/executor.rbs +42 -0
- data/examples/rails/patch/minitest/minitest/parallel/test/class_methods.rbs +6 -0
- data/examples/rails/patch/minitest/minitest/parallel/test.rbs +3 -0
- data/examples/rails/patch/minitest/minitest/parallel.rbs +2 -0
- data/examples/rails/patch/minitest/minitest/pride_io.rbs +54 -0
- data/examples/rails/patch/minitest/minitest/pride_lol.rbs +17 -0
- data/examples/rails/patch/minitest/minitest/progress_reporter.rbs +11 -0
- data/examples/rails/patch/minitest/minitest/reportable.rbs +51 -0
- data/examples/rails/patch/minitest/minitest/reporter.rbs +5 -0
- data/examples/rails/patch/minitest/minitest/result.rbs +28 -0
- data/examples/rails/patch/minitest/minitest/runnable.rbs +131 -0
- data/examples/rails/patch/minitest/minitest/skip.rbs +6 -0
- data/examples/rails/patch/minitest/minitest/spec/dsl/instance_methods.rbs +48 -0
- data/examples/rails/patch/minitest/minitest/spec/dsl.rbs +125 -0
- data/examples/rails/patch/minitest/minitest/spec.rbs +10 -0
- data/examples/rails/patch/minitest/minitest/statistics_reporter.rbs +76 -0
- data/examples/rails/patch/minitest/minitest/summary_reporter.rbs +26 -0
- data/examples/rails/patch/minitest/minitest/test/lifecycle_hooks.rbs +92 -0
- data/examples/rails/patch/minitest/minitest/test.rbs +76 -0
- data/examples/rails/patch/minitest/minitest/unexpected_error.rbs +10 -0
- data/examples/rails/patch/minitest/minitest/unit/test_case.rbs +3 -0
- data/examples/rails/patch/minitest/minitest/unit.rbs +5 -0
- data/examples/rails/patch/minitest/minitest.rbs +966 -0
- data/examples/rails/patch/pg/simple_decoder.rbs +4 -0
- data/examples/rails/patch/pg.rbs +2 -0
- data/examples/rails/patch/qc/queue.rbs +2 -0
- data/examples/rails/patch/qc.rbs +2 -0
- data/examples/rails/patch/que/job.rbs +2 -0
- data/examples/rails/patch/que.rbs +2 -0
- data/examples/rails/patch/rack/cache/entity_store.rbs +2 -0
- data/examples/rails/patch/rack/cache/meta_store.rbs +2 -0
- data/examples/rails/patch/rack/cache.rbs +2 -0
- data/examples/rails/patch/rack/session/dalli.rbs +2 -0
- data/examples/rails/patch/rack/session.rbs +2 -0
- data/examples/rails/patch/rboc.rbs +2 -0
- data/examples/rails/patch/rdoc/generator/sdoc.rbs +3 -0
- data/examples/rails/patch/rdoc/generator.rbs +2 -0
- data/examples/rails/patch/rdoc/task.rbs +2 -0
- data/examples/rails/patch/ripper.rbs +2 -0
- data/examples/rails/patch/sidekiq/worker.rbs +2 -0
- data/examples/rails/patch/sidekiq.rbs +2 -0
- data/examples/rails/patch/sneakers/worker.rbs +2 -0
- data/examples/rails/patch/sneakers.rbs +2 -0
- data/examples/rails/patch/sucker_punch/job.rbs +2 -0
- data/examples/rails/patch/sucker_punch.rbs +2 -0
- data/examples/rails/patch/thor/actions/create_file.rbs +2 -0
- data/examples/rails/patch/thor/actions.rbs +2 -0
- data/examples/rails/patch/thor/error.rbs +2 -0
- data/examples/rails/patch/thor/group.rbs +2 -0
- data/examples/rails/patch/thor.rbs +2 -0
- data/lib/orthoses/active_model/has_secure_password.rb +24 -13
- data/lib/orthoses/active_model/known_sig/7.0/serialization.rbs +4 -0
- data/lib/orthoses/active_model/known_sig/7.0/validations.rbs +4 -0
- data/lib/orthoses/active_model/known_sig.rb +21 -0
- data/lib/orthoses/active_model.rb +4 -0
- data/lib/orthoses/active_record/belongs_to.rb +10 -4
- data/lib/orthoses/active_record/generated_attribute_methods.rb +6 -4
- data/lib/orthoses/active_record/has_many.rb +6 -6
- data/lib/orthoses/active_record/has_one.rb +5 -4
- data/lib/orthoses/active_record/known_sig/6.0/result.rbs +5 -0
- data/lib/orthoses/active_record/known_sig/6.1/result.rbs +5 -0
- data/lib/orthoses/active_record/known_sig/7.0/encryption/context.rbs +9 -0
- data/lib/orthoses/active_record/known_sig/7.0/result.rbs +5 -0
- data/lib/orthoses/active_record/known_sig.rb +21 -0
- data/lib/orthoses/active_record/query_methods.rb +32 -0
- data/lib/orthoses/active_record.rb +8 -0
- data/lib/orthoses/active_support/class_attribute.rb +30 -17
- data/lib/orthoses/active_support/configurable.rb +36 -0
- data/lib/orthoses/active_support/delegation.rb +158 -0
- data/lib/orthoses/active_support/known_sig/7.0/active_support/callbacks/callback_chain.rbs +9 -0
- data/lib/orthoses/active_support/known_sig/7.0/active_support/hash_with_indifferent_access.rbs +6 -0
- data/lib/orthoses/active_support/known_sig/7.0/active_support/multibyte/chars.rbs +7 -0
- data/lib/orthoses/active_support/known_sig/7.0/hash_with_indifferent_access.rbs +2 -0
- data/lib/orthoses/active_support/known_sig/{time.rbs → 7.0/time.rbs} +4 -0
- data/lib/orthoses/active_support/known_sig.rb +21 -0
- data/lib/orthoses/active_support/mattr_accessor.rb +21 -14
- data/lib/orthoses/active_support/time_with_zone.rb +13 -15
- data/lib/orthoses/active_support.rb +24 -0
- data/lib/orthoses/rails/known_sig_helper.rb +22 -0
- data/lib/orthoses/rails/version.rb +1 -1
- data/lib/orthoses/rails.rb +4 -11
- data/orthoses-rails.gemspec +2 -2
- metadata +97 -9
- data/lib/orthoses/active_support/concern.rb +0 -22
- data/lib/orthoses/active_support/known_sig/active_support/time_with_zone.rbs +0 -4
@@ -0,0 +1,258 @@
|
|
1
|
+
# <!-- rdoc-file=lib/minitest/benchmark.rb -->
|
2
|
+
# Subclass Benchmark to create your own benchmark runs. Methods starting with
|
3
|
+
# "bench_" get executed on a per-class.
|
4
|
+
#
|
5
|
+
# See Minitest::Assertions
|
6
|
+
#
|
7
|
+
class Minitest::Benchmark < ::Minitest::Test
|
8
|
+
def self.io: () -> untyped
|
9
|
+
def io: () -> untyped
|
10
|
+
def self.run: (untyped reporter, ?::Hash[untyped, untyped] options) -> untyped
|
11
|
+
def self.runnable_methods: () -> untyped
|
12
|
+
|
13
|
+
# <!--
|
14
|
+
# rdoc-file=lib/minitest/benchmark.rb
|
15
|
+
# - bench_exp(min, max, base = 10)
|
16
|
+
# -->
|
17
|
+
# Returns a set of ranges stepped exponentially from `min` to `max` by powers of
|
18
|
+
# `base`. Eg:
|
19
|
+
#
|
20
|
+
# bench_exp(2, 16, 2) # => [2, 4, 8, 16]
|
21
|
+
#
|
22
|
+
def self.bench_exp: (untyped min, untyped max, ?::Integer base) -> untyped
|
23
|
+
|
24
|
+
# <!--
|
25
|
+
# rdoc-file=lib/minitest/benchmark.rb
|
26
|
+
# - bench_linear(min, max, step = 10)
|
27
|
+
# -->
|
28
|
+
# Returns a set of ranges stepped linearly from `min` to `max` by `step`. Eg:
|
29
|
+
#
|
30
|
+
# bench_linear(20, 40, 10) # => [20, 30, 40]
|
31
|
+
#
|
32
|
+
def self.bench_linear: (untyped min, untyped max, ?::Integer step) -> untyped
|
33
|
+
|
34
|
+
# <!--
|
35
|
+
# rdoc-file=lib/minitest/benchmark.rb
|
36
|
+
# - bench_range()
|
37
|
+
# -->
|
38
|
+
# Specifies the ranges used for benchmarking for that class. Defaults to
|
39
|
+
# exponential growth from 1 to 10k by powers of 10. Override if you need
|
40
|
+
# different ranges for your benchmarks.
|
41
|
+
#
|
42
|
+
# See also: ::bench_exp and ::bench_linear.
|
43
|
+
#
|
44
|
+
def self.bench_range: () -> untyped
|
45
|
+
|
46
|
+
# <!--
|
47
|
+
# rdoc-file=lib/minitest/benchmark.rb
|
48
|
+
# - assert_performance(validation, &work)
|
49
|
+
# -->
|
50
|
+
# Runs the given `work`, gathering the times of each run. Range and times are
|
51
|
+
# then passed to a given `validation` proc. Outputs the benchmark name and times
|
52
|
+
# in tab-separated format, making it easy to paste into a spreadsheet for
|
53
|
+
# graphing or further analysis.
|
54
|
+
#
|
55
|
+
# Ranges are specified by ::bench_range.
|
56
|
+
#
|
57
|
+
# Eg:
|
58
|
+
#
|
59
|
+
# def bench_algorithm
|
60
|
+
# validation = proc { |x, y| ... }
|
61
|
+
# assert_performance validation do |n|
|
62
|
+
# @obj.algorithm(n)
|
63
|
+
# end
|
64
|
+
# end
|
65
|
+
#
|
66
|
+
def assert_performance: (untyped validation) { () -> untyped } -> untyped
|
67
|
+
|
68
|
+
# <!--
|
69
|
+
# rdoc-file=lib/minitest/benchmark.rb
|
70
|
+
# - assert_performance_constant(threshold = 0.99, &work)
|
71
|
+
# -->
|
72
|
+
# Runs the given `work` and asserts that the times gathered fit to match a
|
73
|
+
# constant rate (eg, linear slope == 0) within a given `threshold`. Note:
|
74
|
+
# because we're testing for a slope of 0, R^2 is not a good determining factor
|
75
|
+
# for the fit, so the threshold is applied against the slope itself. As such,
|
76
|
+
# you probably want to tighten it from the default.
|
77
|
+
#
|
78
|
+
# See
|
79
|
+
# https://www.graphpad.com/guides/prism/8/curve-fitting/reg_intepretingnonlinr2.
|
80
|
+
# htm for more details.
|
81
|
+
#
|
82
|
+
# Fit is calculated by #fit_linear.
|
83
|
+
#
|
84
|
+
# Ranges are specified by ::bench_range.
|
85
|
+
#
|
86
|
+
# Eg:
|
87
|
+
#
|
88
|
+
# def bench_algorithm
|
89
|
+
# assert_performance_constant 0.9999 do |n|
|
90
|
+
# @obj.algorithm(n)
|
91
|
+
# end
|
92
|
+
# end
|
93
|
+
#
|
94
|
+
def assert_performance_constant: (?::Float threshold) { () -> untyped } -> untyped
|
95
|
+
|
96
|
+
# <!--
|
97
|
+
# rdoc-file=lib/minitest/benchmark.rb
|
98
|
+
# - assert_performance_exponential(threshold = 0.99, &work)
|
99
|
+
# -->
|
100
|
+
# Runs the given `work` and asserts that the times gathered fit to match a
|
101
|
+
# exponential curve within a given error `threshold`.
|
102
|
+
#
|
103
|
+
# Fit is calculated by #fit_exponential.
|
104
|
+
#
|
105
|
+
# Ranges are specified by ::bench_range.
|
106
|
+
#
|
107
|
+
# Eg:
|
108
|
+
#
|
109
|
+
# def bench_algorithm
|
110
|
+
# assert_performance_exponential 0.9999 do |n|
|
111
|
+
# @obj.algorithm(n)
|
112
|
+
# end
|
113
|
+
# end
|
114
|
+
#
|
115
|
+
def assert_performance_exponential: (?::Float threshold) { () -> untyped } -> untyped
|
116
|
+
|
117
|
+
# <!--
|
118
|
+
# rdoc-file=lib/minitest/benchmark.rb
|
119
|
+
# - assert_performance_logarithmic(threshold = 0.99, &work)
|
120
|
+
# -->
|
121
|
+
# Runs the given `work` and asserts that the times gathered fit to match a
|
122
|
+
# logarithmic curve within a given error `threshold`.
|
123
|
+
#
|
124
|
+
# Fit is calculated by #fit_logarithmic.
|
125
|
+
#
|
126
|
+
# Ranges are specified by ::bench_range.
|
127
|
+
#
|
128
|
+
# Eg:
|
129
|
+
#
|
130
|
+
# def bench_algorithm
|
131
|
+
# assert_performance_logarithmic 0.9999 do |n|
|
132
|
+
# @obj.algorithm(n)
|
133
|
+
# end
|
134
|
+
# end
|
135
|
+
#
|
136
|
+
def assert_performance_logarithmic: (?::Float threshold) { () -> untyped } -> untyped
|
137
|
+
|
138
|
+
# <!--
|
139
|
+
# rdoc-file=lib/minitest/benchmark.rb
|
140
|
+
# - assert_performance_linear(threshold = 0.99, &work)
|
141
|
+
# -->
|
142
|
+
# Runs the given `work` and asserts that the times gathered fit to match a
|
143
|
+
# straight line within a given error `threshold`.
|
144
|
+
#
|
145
|
+
# Fit is calculated by #fit_linear.
|
146
|
+
#
|
147
|
+
# Ranges are specified by ::bench_range.
|
148
|
+
#
|
149
|
+
# Eg:
|
150
|
+
#
|
151
|
+
# def bench_algorithm
|
152
|
+
# assert_performance_linear 0.9999 do |n|
|
153
|
+
# @obj.algorithm(n)
|
154
|
+
# end
|
155
|
+
# end
|
156
|
+
#
|
157
|
+
def assert_performance_linear: (?::Float threshold) { () -> untyped } -> untyped
|
158
|
+
|
159
|
+
# <!--
|
160
|
+
# rdoc-file=lib/minitest/benchmark.rb
|
161
|
+
# - assert_performance_power(threshold = 0.99, &work)
|
162
|
+
# -->
|
163
|
+
# Runs the given `work` and asserts that the times gathered curve fit to match a
|
164
|
+
# power curve within a given error `threshold`.
|
165
|
+
#
|
166
|
+
# Fit is calculated by #fit_power.
|
167
|
+
#
|
168
|
+
# Ranges are specified by ::bench_range.
|
169
|
+
#
|
170
|
+
# Eg:
|
171
|
+
#
|
172
|
+
# def bench_algorithm
|
173
|
+
# assert_performance_power 0.9999 do |x|
|
174
|
+
# @obj.algorithm
|
175
|
+
# end
|
176
|
+
# end
|
177
|
+
#
|
178
|
+
def assert_performance_power: (?::Float threshold) { () -> untyped } -> untyped
|
179
|
+
|
180
|
+
# <!--
|
181
|
+
# rdoc-file=lib/minitest/benchmark.rb
|
182
|
+
# - fit_error(xys) { |x| ... }
|
183
|
+
# -->
|
184
|
+
# Takes an array of x/y pairs and calculates the general R^2 value.
|
185
|
+
#
|
186
|
+
# See: http://en.wikipedia.org/wiki/Coefficient_of_determination
|
187
|
+
#
|
188
|
+
def fit_error: (untyped xys) { (untyped) -> untyped } -> untyped
|
189
|
+
|
190
|
+
# <!--
|
191
|
+
# rdoc-file=lib/minitest/benchmark.rb
|
192
|
+
# - fit_exponential(xs, ys)
|
193
|
+
# -->
|
194
|
+
# To fit a functional form: y = ae^(bx).
|
195
|
+
#
|
196
|
+
# Takes x and y values and returns [a, b, r^2].
|
197
|
+
#
|
198
|
+
# See: http://mathworld.wolfram.com/LeastSquaresFittingExponential.html
|
199
|
+
#
|
200
|
+
def fit_exponential: (untyped xs, untyped ys) -> untyped
|
201
|
+
|
202
|
+
# <!--
|
203
|
+
# rdoc-file=lib/minitest/benchmark.rb
|
204
|
+
# - fit_logarithmic(xs, ys)
|
205
|
+
# -->
|
206
|
+
# To fit a functional form: y = a + b*ln(x).
|
207
|
+
#
|
208
|
+
# Takes x and y values and returns [a, b, r^2].
|
209
|
+
#
|
210
|
+
# See: http://mathworld.wolfram.com/LeastSquaresFittingLogarithmic.html
|
211
|
+
#
|
212
|
+
def fit_logarithmic: (untyped xs, untyped ys) -> untyped
|
213
|
+
|
214
|
+
# <!--
|
215
|
+
# rdoc-file=lib/minitest/benchmark.rb
|
216
|
+
# - fit_linear(xs, ys)
|
217
|
+
# -->
|
218
|
+
# Fits the functional form: a + bx.
|
219
|
+
#
|
220
|
+
# Takes x and y values and returns [a, b, r^2].
|
221
|
+
#
|
222
|
+
# See: http://mathworld.wolfram.com/LeastSquaresFitting.html
|
223
|
+
#
|
224
|
+
def fit_linear: (untyped xs, untyped ys) -> untyped
|
225
|
+
|
226
|
+
# <!--
|
227
|
+
# rdoc-file=lib/minitest/benchmark.rb
|
228
|
+
# - fit_power(xs, ys)
|
229
|
+
# -->
|
230
|
+
# To fit a functional form: y = ax^b.
|
231
|
+
#
|
232
|
+
# Takes x and y values and returns [a, b, r^2].
|
233
|
+
#
|
234
|
+
# See: http://mathworld.wolfram.com/LeastSquaresFittingPowerLaw.html
|
235
|
+
#
|
236
|
+
def fit_power: (untyped xs, untyped ys) -> untyped
|
237
|
+
|
238
|
+
# <!--
|
239
|
+
# rdoc-file=lib/minitest/benchmark.rb
|
240
|
+
# - sigma(enum, &block)
|
241
|
+
# -->
|
242
|
+
# Enumerates over `enum` mapping `block` if given, returning the sum of the
|
243
|
+
# result. Eg:
|
244
|
+
#
|
245
|
+
# sigma([1, 2, 3]) # => 1 + 2 + 3 => 6
|
246
|
+
# sigma([1, 2, 3]) { |n| n ** 2 } # => 1 + 4 + 9 => 14
|
247
|
+
#
|
248
|
+
def sigma: (untyped enum) { () -> untyped } -> untyped
|
249
|
+
|
250
|
+
# <!--
|
251
|
+
# rdoc-file=lib/minitest/benchmark.rb
|
252
|
+
# - validation_for_fit(msg, threshold)
|
253
|
+
# -->
|
254
|
+
# Returns a proc that calls the specified fit method and asserts that the error
|
255
|
+
# is within a tolerable threshold.
|
256
|
+
#
|
257
|
+
def validation_for_fit: (untyped msg, untyped threshold) -> untyped
|
258
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# <!-- rdoc-file=lib/minitest.rb -->
|
2
|
+
# Dispatch to multiple reporters as one.
|
3
|
+
#
|
4
|
+
class Minitest::CompositeReporter < ::Minitest::AbstractReporter
|
5
|
+
def initialize: (*untyped reporters) -> void
|
6
|
+
def io: () -> untyped
|
7
|
+
|
8
|
+
# <!--
|
9
|
+
# rdoc-file=lib/minitest.rb
|
10
|
+
# - <<(reporter)
|
11
|
+
# -->
|
12
|
+
# Add another reporter to the mix.
|
13
|
+
#
|
14
|
+
def <<: (untyped reporter) -> untyped
|
15
|
+
def passed?: () -> untyped
|
16
|
+
def start: () -> untyped
|
17
|
+
def prerecord: (untyped klass, untyped name) -> untyped
|
18
|
+
def record: (untyped result) -> untyped
|
19
|
+
def report: () -> untyped
|
20
|
+
|
21
|
+
# <!-- rdoc-file=lib/minitest.rb -->
|
22
|
+
# The list of reporters to dispatch to.
|
23
|
+
#
|
24
|
+
attr_accessor reporters: untyped
|
25
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# <!-- rdoc-file=lib/minitest/expectations.rb -->
|
2
|
+
# It's where you hide your "assertions".
|
3
|
+
#
|
4
|
+
# Please note, because of the way that expectations are implemented, all
|
5
|
+
# expectations (eg must_equal) are dependent upon a thread local variable
|
6
|
+
# `:current_spec`. If your specs rely on mixing threads into the specs
|
7
|
+
# themselves, you're better off using assertions or the new _(value) wrapper.
|
8
|
+
# For example:
|
9
|
+
#
|
10
|
+
# it "should still work in threads" do
|
11
|
+
# my_threaded_thingy do
|
12
|
+
# (1+1).must_equal 2 # bad
|
13
|
+
# assert_equal 2, 1+1 # good
|
14
|
+
# _(1 + 1).must_equal 2 # good
|
15
|
+
# value(1 + 1).must_equal 2 # good, also #expect
|
16
|
+
# _ { 1 + "1" }.must_raise TypeError # good
|
17
|
+
# end
|
18
|
+
# end
|
19
|
+
#
|
20
|
+
module Minitest::Expectations
|
21
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
# <!-- rdoc-file=lib/minitest.rb -->
|
2
|
+
# Provides a simple set of guards that you can use in your tests to skip
|
3
|
+
# execution if it is not applicable. These methods are mixed into Test as both
|
4
|
+
# instance and class methods so you can use them inside or outside of the test
|
5
|
+
# methods.
|
6
|
+
#
|
7
|
+
# def test_something_for_mri
|
8
|
+
# skip "bug 1234" if jruby?
|
9
|
+
# # ...
|
10
|
+
# end
|
11
|
+
#
|
12
|
+
# if windows? then
|
13
|
+
# # ... lots of test methods ...
|
14
|
+
# end
|
15
|
+
#
|
16
|
+
module Minitest::Guard
|
17
|
+
# <!--
|
18
|
+
# rdoc-file=lib/minitest.rb
|
19
|
+
# - jruby?(platform = RUBY_PLATFORM)
|
20
|
+
# -->
|
21
|
+
# Is this running on jruby?
|
22
|
+
#
|
23
|
+
def jruby?: (?untyped platform) -> untyped
|
24
|
+
|
25
|
+
# <!--
|
26
|
+
# rdoc-file=lib/minitest.rb
|
27
|
+
# - maglev?(platform = defined?(RUBY_ENGINE) && RUBY_ENGINE)
|
28
|
+
# -->
|
29
|
+
# Is this running on maglev?
|
30
|
+
#
|
31
|
+
def maglev?: (?untyped platform) -> untyped
|
32
|
+
|
33
|
+
# <!--
|
34
|
+
# rdoc-file=lib/minitest.rb
|
35
|
+
# - mri?(platform = RUBY_DESCRIPTION)
|
36
|
+
# -->
|
37
|
+
# Is this running on mri?
|
38
|
+
#
|
39
|
+
def mri?: (?untyped platform) -> untyped
|
40
|
+
|
41
|
+
# <!--
|
42
|
+
# rdoc-file=lib/minitest.rb
|
43
|
+
# - osx?(platform = RUBY_PLATFORM)
|
44
|
+
# -->
|
45
|
+
# Is this running on macOS?
|
46
|
+
#
|
47
|
+
def osx?: (?untyped platform) -> untyped
|
48
|
+
|
49
|
+
# <!--
|
50
|
+
# rdoc-file=lib/minitest.rb
|
51
|
+
# - rubinius?(platform = defined?(RUBY_ENGINE) && RUBY_ENGINE)
|
52
|
+
# -->
|
53
|
+
# Is this running on rubinius?
|
54
|
+
#
|
55
|
+
def rubinius?: (?untyped platform) -> untyped
|
56
|
+
|
57
|
+
# <!--
|
58
|
+
# rdoc-file=lib/minitest.rb
|
59
|
+
# - windows?(platform = RUBY_PLATFORM)
|
60
|
+
# -->
|
61
|
+
# Is this running on windows?
|
62
|
+
#
|
63
|
+
def windows?: (?untyped platform) -> untyped
|
64
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
# <!-- rdoc-file=lib/minitest/mock.rb -->
|
2
|
+
# A simple and clean mock object framework.
|
3
|
+
#
|
4
|
+
# All mock objects are an instance of Mock
|
5
|
+
#
|
6
|
+
class Minitest::Mock
|
7
|
+
alias __respond_to? respond_to?
|
8
|
+
def initialize: (?untyped? delegator) -> void
|
9
|
+
|
10
|
+
# <!--
|
11
|
+
# rdoc-file=lib/minitest/mock.rb
|
12
|
+
# - expect(name, retval, args = [], &blk)
|
13
|
+
# -->
|
14
|
+
# Expect that method `name` is called, optionally with `args` or a `blk`, and
|
15
|
+
# returns `retval`.
|
16
|
+
#
|
17
|
+
# @mock.expect(:meaning_of_life, 42)
|
18
|
+
# @mock.meaning_of_life # => 42
|
19
|
+
#
|
20
|
+
# @mock.expect(:do_something_with, true, [some_obj, true])
|
21
|
+
# @mock.do_something_with(some_obj, true) # => true
|
22
|
+
#
|
23
|
+
# @mock.expect(:do_something_else, true) do |a1, a2|
|
24
|
+
# a1 == "buggs" && a2 == :bunny
|
25
|
+
# end
|
26
|
+
#
|
27
|
+
# `args` is compared to the expected args using case equality (ie, the '==='
|
28
|
+
# operator), allowing for less specific expectations.
|
29
|
+
#
|
30
|
+
# @mock.expect(:uses_any_string, true, [String])
|
31
|
+
# @mock.uses_any_string("foo") # => true
|
32
|
+
# @mock.verify # => true
|
33
|
+
#
|
34
|
+
# @mock.expect(:uses_one_string, true, ["foo"])
|
35
|
+
# @mock.uses_one_string("bar") # => raises MockExpectationError
|
36
|
+
#
|
37
|
+
# If a method will be called multiple times, specify a new expect for each one.
|
38
|
+
# They will be used in the order you define them.
|
39
|
+
#
|
40
|
+
# @mock.expect(:ordinal_increment, 'first')
|
41
|
+
# @mock.expect(:ordinal_increment, 'second')
|
42
|
+
#
|
43
|
+
# @mock.ordinal_increment # => 'first'
|
44
|
+
# @mock.ordinal_increment # => 'second'
|
45
|
+
# @mock.ordinal_increment # => raises MockExpectationError "No more expects available for :ordinal_increment"
|
46
|
+
#
|
47
|
+
def expect: (untyped name, untyped retval, ?untyped args) { () -> untyped } -> self
|
48
|
+
def __call: (untyped name, untyped data) -> untyped
|
49
|
+
|
50
|
+
# <!--
|
51
|
+
# rdoc-file=lib/minitest/mock.rb
|
52
|
+
# - verify()
|
53
|
+
# -->
|
54
|
+
# Verify that all methods were called as expected. Raises `MockExpectationError`
|
55
|
+
# if the mock object was not called as expected.
|
56
|
+
#
|
57
|
+
def verify: () -> true
|
58
|
+
def method_missing: (untyped sym, *untyped args) { () -> untyped } -> untyped
|
59
|
+
def respond_to?: (untyped sym, ?bool include_private) -> (true | untyped)
|
60
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# <!-- rdoc-file=lib/minitest/parallel.rb -->
|
2
|
+
# The engine used to run multiple tests in parallel.
|
3
|
+
#
|
4
|
+
class Minitest::Parallel::Executor
|
5
|
+
# <!--
|
6
|
+
# rdoc-file=lib/minitest/parallel.rb
|
7
|
+
# - new(size)
|
8
|
+
# -->
|
9
|
+
# Create a parallel test executor of with `size` workers.
|
10
|
+
#
|
11
|
+
def initialize: (untyped size) -> void
|
12
|
+
|
13
|
+
# <!--
|
14
|
+
# rdoc-file=lib/minitest/parallel.rb
|
15
|
+
# - start()
|
16
|
+
# -->
|
17
|
+
# Start the executor
|
18
|
+
#
|
19
|
+
def start: () -> untyped
|
20
|
+
|
21
|
+
# <!--
|
22
|
+
# rdoc-file=lib/minitest/parallel.rb
|
23
|
+
# - <<(work;)
|
24
|
+
# -->
|
25
|
+
# Add a job to the queue
|
26
|
+
#
|
27
|
+
def <<: (untyped work) -> untyped
|
28
|
+
|
29
|
+
# <!--
|
30
|
+
# rdoc-file=lib/minitest/parallel.rb
|
31
|
+
# - shutdown()
|
32
|
+
# -->
|
33
|
+
# Shuts down the pool of workers by signalling them to quit and waiting for them
|
34
|
+
# all to finish what they're currently working on.
|
35
|
+
#
|
36
|
+
def shutdown: () -> untyped
|
37
|
+
|
38
|
+
# <!-- rdoc-file=lib/minitest/parallel.rb -->
|
39
|
+
# The size of the pool of workers.
|
40
|
+
#
|
41
|
+
attr_reader size: untyped
|
42
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# <!-- rdoc-file=lib/minitest/pride_plugin.rb -->
|
2
|
+
# Show your testing pride!
|
3
|
+
#
|
4
|
+
class Minitest::PrideIO
|
5
|
+
# <!--
|
6
|
+
# rdoc-file=lib/minitest/pride_plugin.rb
|
7
|
+
# - pride!()
|
8
|
+
# -->
|
9
|
+
# Activate the pride plugin. Called from both -p option and minitest/pride
|
10
|
+
#
|
11
|
+
def self.pride!: () -> untyped
|
12
|
+
|
13
|
+
# <!--
|
14
|
+
# rdoc-file=lib/minitest/pride_plugin.rb
|
15
|
+
# - pride?()
|
16
|
+
# -->
|
17
|
+
# Are we showing our testing pride?
|
18
|
+
#
|
19
|
+
def self.pride?: () -> untyped
|
20
|
+
def initialize: (untyped io) -> void
|
21
|
+
|
22
|
+
# <!--
|
23
|
+
# rdoc-file=lib/minitest/pride_plugin.rb
|
24
|
+
# - print(o)
|
25
|
+
# -->
|
26
|
+
# Wrap print to colorize the output.
|
27
|
+
#
|
28
|
+
def print: (untyped o) -> untyped
|
29
|
+
def puts: (*untyped o) -> untyped
|
30
|
+
|
31
|
+
# <!--
|
32
|
+
# rdoc-file=lib/minitest/pride_plugin.rb
|
33
|
+
# - pride(string)
|
34
|
+
# -->
|
35
|
+
# Color a string.
|
36
|
+
#
|
37
|
+
def pride: (untyped string) -> ::String
|
38
|
+
def method_missing: (untyped msg, *untyped args) -> untyped
|
39
|
+
|
40
|
+
# <!-- rdoc-file=lib/minitest/pride_plugin.rb -->
|
41
|
+
# The IO we're going to pipe through.
|
42
|
+
#
|
43
|
+
attr_reader io: untyped
|
44
|
+
|
45
|
+
# <!-- rdoc-file=lib/minitest/pride_plugin.rb -->
|
46
|
+
# End the escape sequence
|
47
|
+
#
|
48
|
+
NND: String
|
49
|
+
|
50
|
+
# <!-- rdoc-file=lib/minitest/pride_plugin.rb -->
|
51
|
+
# Start an escape sequence
|
52
|
+
#
|
53
|
+
ESC: String
|
54
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# <!-- rdoc-file=lib/minitest/pride_plugin.rb -->
|
2
|
+
# If you thought the PrideIO was colorful...
|
3
|
+
#
|
4
|
+
# (Inspired by lolcat, but with clean math)
|
5
|
+
#
|
6
|
+
class Minitest::PrideLOL < ::Minitest::PrideIO
|
7
|
+
def initialize: (untyped io) -> void
|
8
|
+
|
9
|
+
# <!--
|
10
|
+
# rdoc-file=lib/minitest/pride_plugin.rb
|
11
|
+
# - pride(string)
|
12
|
+
# -->
|
13
|
+
# Make the string even more colorful. Damnit.
|
14
|
+
#
|
15
|
+
def pride: (untyped string) -> ::String
|
16
|
+
PI_3: Float
|
17
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# <!-- rdoc-file=lib/minitest.rb -->
|
2
|
+
# A very simple reporter that prints the "dots" during the run.
|
3
|
+
#
|
4
|
+
# This is added to the top-level CompositeReporter at the start of the run. If
|
5
|
+
# you want to change the output of minitest via a plugin, pull this out of the
|
6
|
+
# composite and replace it with your own.
|
7
|
+
#
|
8
|
+
class Minitest::ProgressReporter < ::Minitest::Reporter
|
9
|
+
def prerecord: (untyped klass, untyped name) -> (untyped | nil)
|
10
|
+
def record: (untyped result) -> untyped
|
11
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# <!-- rdoc-file=lib/minitest.rb -->
|
2
|
+
# Shared code for anything that can get passed to a Reporter. See Minitest::Test
|
3
|
+
# & Minitest::Result.
|
4
|
+
#
|
5
|
+
module Minitest::Reportable
|
6
|
+
# <!--
|
7
|
+
# rdoc-file=lib/minitest.rb
|
8
|
+
# - passed?()
|
9
|
+
# -->
|
10
|
+
# Did this run pass?
|
11
|
+
#
|
12
|
+
# Note: skipped runs are not considered passing, but they don't cause the
|
13
|
+
# process to exit non-zero.
|
14
|
+
#
|
15
|
+
def passed?: () -> untyped
|
16
|
+
|
17
|
+
# <!--
|
18
|
+
# rdoc-file=lib/minitest.rb
|
19
|
+
# - location()
|
20
|
+
# -->
|
21
|
+
# The location identifier of this test. Depends on a method existing called
|
22
|
+
# class_name.
|
23
|
+
#
|
24
|
+
def location: () -> ::String
|
25
|
+
|
26
|
+
def class_name: () -> untyped
|
27
|
+
|
28
|
+
# <!--
|
29
|
+
# rdoc-file=lib/minitest.rb
|
30
|
+
# - result_code()
|
31
|
+
# -->
|
32
|
+
# Returns ".", "F", or "E" based on the result of the run.
|
33
|
+
#
|
34
|
+
def result_code: () -> untyped
|
35
|
+
|
36
|
+
# <!--
|
37
|
+
# rdoc-file=lib/minitest.rb
|
38
|
+
# - skipped?()
|
39
|
+
# -->
|
40
|
+
# Was this run skipped?
|
41
|
+
#
|
42
|
+
def skipped?: () -> untyped
|
43
|
+
|
44
|
+
# <!--
|
45
|
+
# rdoc-file=lib/minitest.rb
|
46
|
+
# - error?()
|
47
|
+
# -->
|
48
|
+
# Did this run error?
|
49
|
+
#
|
50
|
+
def error?: () -> untyped
|
51
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# <!-- rdoc-file=lib/minitest.rb -->
|
2
|
+
# This represents a test result in a clean way that can be marshalled over a
|
3
|
+
# wire. Tests can do anything they want to the test instance and can create
|
4
|
+
# conditions that cause Marshal.dump to blow up. By using Result.from(a_test)
|
5
|
+
# you can be reasonably sure that the test result can be marshalled.
|
6
|
+
#
|
7
|
+
class Minitest::Result < ::Minitest::Runnable
|
8
|
+
# <!--
|
9
|
+
# rdoc-file=lib/minitest.rb
|
10
|
+
# - from(runnable)
|
11
|
+
# -->
|
12
|
+
# Create a new test result from a Runnable instance.
|
13
|
+
#
|
14
|
+
def self.from: (untyped runnable) -> untyped
|
15
|
+
def class_name: () -> untyped
|
16
|
+
def to_s: () -> untyped
|
17
|
+
|
18
|
+
# <!-- rdoc-file=lib/minitest.rb -->
|
19
|
+
# The class name of the test result.
|
20
|
+
#
|
21
|
+
attr_accessor klass: untyped
|
22
|
+
|
23
|
+
# <!-- rdoc-file=lib/minitest.rb -->
|
24
|
+
# The location of the test method.
|
25
|
+
#
|
26
|
+
attr_accessor source_location: untyped
|
27
|
+
include Minitest::Reportable
|
28
|
+
end
|