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,131 @@
1
+ # <!-- rdoc-file=lib/minitest.rb -->
2
+ # Represents anything "runnable", like Test, Spec, Benchmark, or whatever you
3
+ # can dream up.
4
+ #
5
+ # Subclasses of this are automatically registered and available in
6
+ # Runnable.runnables.
7
+ #
8
+ class Minitest::Runnable
9
+ def time_it: () { () -> untyped } -> untyped
10
+
11
+ # <!--
12
+ # rdoc-file=lib/minitest.rb
13
+ # - name()
14
+ # -->
15
+ # Name of the run.
16
+ #
17
+ def name: () -> untyped
18
+
19
+ # <!--
20
+ # rdoc-file=lib/minitest.rb
21
+ # - name=(o)
22
+ # -->
23
+ # Set the name of the run.
24
+ #
25
+ def name=: (untyped o) -> untyped
26
+
27
+ # <!--
28
+ # rdoc-file=lib/minitest.rb
29
+ # - methods_matching(re)
30
+ # -->
31
+ # Returns all instance methods matching the pattern `re`.
32
+ #
33
+ def self.methods_matching: (untyped re) -> untyped
34
+ def self.reset: () -> untyped
35
+
36
+ # <!--
37
+ # rdoc-file=lib/minitest.rb
38
+ # - run(reporter, options = {})
39
+ # -->
40
+ # Responsible for running all runnable methods in a given class, each in its own
41
+ # instance. Each instance is passed to the reporter to record.
42
+ #
43
+ def self.run: (untyped reporter, ?::Hash[untyped, untyped] options) -> (nil | untyped)
44
+
45
+ # <!--
46
+ # rdoc-file=lib/minitest.rb
47
+ # - run_one_method(klass, method_name, reporter)
48
+ # -->
49
+ # Runs a single method and has the reporter record the result. This was
50
+ # considered internal API but is factored out of run so that subclasses can
51
+ # specialize the running of an individual test. See
52
+ # Minitest::ParallelTest::ClassMethods for an example.
53
+ #
54
+ def self.run_one_method: (untyped klass, untyped method_name, untyped reporter) -> untyped
55
+ def self.with_info_handler: (untyped reporter) { () -> untyped } -> untyped
56
+ def self.on_signal: (untyped name, untyped action) { () -> untyped } -> untyped
57
+
58
+ # <!--
59
+ # rdoc-file=lib/minitest.rb
60
+ # - runnable_methods()
61
+ # -->
62
+ # Each subclass of Runnable is responsible for overriding this method to return
63
+ # all runnable methods. See #methods_matching.
64
+ #
65
+ def self.runnable_methods: () -> untyped
66
+
67
+ # <!--
68
+ # rdoc-file=lib/minitest.rb
69
+ # - runnables()
70
+ # -->
71
+ # Returns all subclasses of Runnable.
72
+ #
73
+ def self.runnables: () -> untyped
74
+ def marshal_dump: () -> ::Array[untyped]
75
+ def marshal_load: (untyped ary) -> untyped
76
+ def failure: () -> untyped
77
+ def initialize: (untyped name) -> void
78
+
79
+ # <!--
80
+ # rdoc-file=lib/minitest.rb
81
+ # - run()
82
+ # -->
83
+ # Runs a single method. Needs to return self.
84
+ #
85
+ def run: () -> untyped
86
+
87
+ # <!--
88
+ # rdoc-file=lib/minitest.rb
89
+ # - passed?()
90
+ # -->
91
+ # Did this run pass?
92
+ #
93
+ # Note: skipped runs are not considered passing, but they don't cause the
94
+ # process to exit non-zero.
95
+ #
96
+ def passed?: () -> untyped
97
+
98
+ # <!--
99
+ # rdoc-file=lib/minitest.rb
100
+ # - result_code()
101
+ # -->
102
+ # Returns a single character string to print based on the result of the run. One
103
+ # of `"."`, `"F"`, `"E"` or `"S"`.
104
+ #
105
+ def result_code: () -> untyped
106
+
107
+ # <!--
108
+ # rdoc-file=lib/minitest.rb
109
+ # - skipped?()
110
+ # -->
111
+ # Was this run skipped? See #passed? for more information.
112
+ #
113
+ def skipped?: () -> untyped
114
+ def self.inherited: (untyped klass) -> untyped
115
+
116
+ # <!-- rdoc-file=lib/minitest.rb -->
117
+ # Number of assertions executed in this run.
118
+ #
119
+ attr_accessor assertions: untyped
120
+
121
+ # <!-- rdoc-file=lib/minitest.rb -->
122
+ # An assertion raised during the run, if any.
123
+ #
124
+ attr_accessor failures: untyped
125
+
126
+ # <!-- rdoc-file=lib/minitest.rb -->
127
+ # The time it took to run.
128
+ #
129
+ attr_accessor time: untyped
130
+ SIGNALS: Hash[String, Integer]
131
+ end
@@ -0,0 +1,6 @@
1
+ # <!-- rdoc-file=lib/minitest.rb -->
2
+ # Assertion raised when skipping a run.
3
+ #
4
+ class Minitest::Skip < ::Minitest::Assertion
5
+ def result_label: () -> "Skipped"
6
+ end
@@ -0,0 +1,48 @@
1
+ # <!-- rdoc-file=lib/minitest/spec.rb -->
2
+ # Rdoc... why are you so dumb?
3
+ #
4
+ module Minitest::Spec::DSL::InstanceMethods
5
+ # <!--
6
+ # rdoc-file=lib/minitest/spec.rb
7
+ # - _(value = nil, &block)
8
+ # -->
9
+ # Takes a value or a block and returns a value monad that has all of
10
+ # Expectations methods available to it.
11
+ #
12
+ # _(1 + 1).must_equal 2
13
+ #
14
+ # And for blocks:
15
+ #
16
+ # _ { 1 + "1" }.must_raise TypeError
17
+ #
18
+ # This method of expectation-based testing is preferable to straight-expectation
19
+ # methods (on Object) because it stores its test context, bypassing our hacky
20
+ # use of thread-local variables.
21
+ #
22
+ # NOTE: At some point, the methods on Object will be deprecated and then
23
+ # removed.
24
+ #
25
+ # It is also aliased to #value and #expect for your aesthetic pleasure:
26
+ #
27
+ # _(1 + 1).must_equal 2
28
+ # value(1 + 1).must_equal 2
29
+ # expect(1 + 1).must_equal 2
30
+ #
31
+ def _: (?untyped? value) { () -> untyped } -> untyped
32
+
33
+ # <!--
34
+ # rdoc-file=lib/minitest/spec.rb
35
+ # - value(value = nil, &block)
36
+ # -->
37
+ #
38
+ alias value _
39
+
40
+ # <!--
41
+ # rdoc-file=lib/minitest/spec.rb
42
+ # - expect(value = nil, &block)
43
+ # -->
44
+ #
45
+ alias expect _
46
+
47
+ def before_setup: () -> untyped
48
+ end
@@ -0,0 +1,125 @@
1
+ # <!-- rdoc-file=lib/minitest/spec.rb -->
2
+ # Oh look! A Minitest::Spec::DSL module! Eat your heart out DHH.
3
+ #
4
+ module Minitest::Spec::DSL
5
+ # <!--
6
+ # rdoc-file=lib/minitest/spec.rb
7
+ # - register_spec_type(*args, &block)
8
+ # -->
9
+ # Register a new type of spec that matches the spec's description. This method
10
+ # can take either a Regexp and a spec class or a spec class and a block that
11
+ # takes the description and returns true if it matches.
12
+ #
13
+ # Eg:
14
+ #
15
+ # register_spec_type(/Controller$/, Minitest::Spec::Rails)
16
+ #
17
+ # or:
18
+ #
19
+ # register_spec_type(Minitest::Spec::RailsModel) do |desc|
20
+ # desc.superclass == ActiveRecord::Base
21
+ # end
22
+ #
23
+ def register_spec_type: (*untyped args) { () -> untyped } -> untyped
24
+
25
+ # <!--
26
+ # rdoc-file=lib/minitest/spec.rb
27
+ # - spec_type(desc, *additional)
28
+ # -->
29
+ # Figure out the spec class to use based on a spec's description. Eg:
30
+ #
31
+ # spec_type("BlahController") # => Minitest::Spec::Rails
32
+ #
33
+ def spec_type: (untyped desc, *untyped additional) -> untyped
34
+
35
+ def describe_stack: () -> untyped
36
+
37
+ def children: () -> untyped
38
+
39
+ def nuke_test_methods!: () -> untyped
40
+
41
+ # <!--
42
+ # rdoc-file=lib/minitest/spec.rb
43
+ # - before(_type = nil, &block)
44
+ # -->
45
+ # Define a 'before' action. Inherits the way normal methods should.
46
+ #
47
+ # NOTE: `type` is ignored and is only there to make porting easier.
48
+ #
49
+ # Equivalent to Minitest::Test#setup.
50
+ #
51
+ def before: (?untyped? _type) { () -> untyped } -> untyped
52
+
53
+ # <!--
54
+ # rdoc-file=lib/minitest/spec.rb
55
+ # - after(_type = nil, &block)
56
+ # -->
57
+ # Define an 'after' action. Inherits the way normal methods should.
58
+ #
59
+ # NOTE: `type` is ignored and is only there to make porting easier.
60
+ #
61
+ # Equivalent to Minitest::Test#teardown.
62
+ #
63
+ def after: (?untyped? _type) { () -> untyped } -> untyped
64
+
65
+ # <!--
66
+ # rdoc-file=lib/minitest/spec.rb
67
+ # - it(desc = "anonymous", &block)
68
+ # -->
69
+ # Define an expectation with name `desc`. Name gets morphed to a proper test
70
+ # method name. For some freakish reason, people who write specs don't like class
71
+ # inheritance, so this goes way out of its way to make sure that expectations
72
+ # aren't inherited.
73
+ #
74
+ # This is also aliased to #specify and doesn't require a `desc` arg.
75
+ #
76
+ # Hint: If you *do* want inheritance, use minitest/test. You can mix and match
77
+ # between assertions and expectations as much as you want.
78
+ #
79
+ def it: (?::String desc) { () -> untyped } -> untyped
80
+
81
+ # <!--
82
+ # rdoc-file=lib/minitest/spec.rb
83
+ # - let(name, &block)
84
+ # -->
85
+ # Essentially, define an accessor for `name` with `block`.
86
+ #
87
+ # Why use let instead of def? I honestly don't know.
88
+ #
89
+ def let: (untyped name) { () -> untyped } -> untyped
90
+
91
+ # <!--
92
+ # rdoc-file=lib/minitest/spec.rb
93
+ # - subject(&block)
94
+ # -->
95
+ # Another lazy man's accessor generator. Made even more lazy by setting the name
96
+ # for you to `subject`.
97
+ #
98
+ def subject: () { () -> untyped } -> untyped
99
+
100
+ def create: (untyped name, untyped desc) -> untyped
101
+
102
+ def name: () -> untyped
103
+
104
+ def to_s: () -> untyped
105
+
106
+ # <!--
107
+ # rdoc-file=lib/minitest/spec.rb
108
+ # - specify(desc = "anonymous", &block)
109
+ # -->
110
+ #
111
+ alias specify it
112
+
113
+ def self.extended: (untyped obj) -> untyped
114
+
115
+ attr_reader desc: untyped
116
+
117
+ # <!-- rdoc-file=lib/minitest/spec.rb -->
118
+ # Contains pairs of matchers and Spec classes to be used to calculate the
119
+ # superclass of a top-level describe. This allows for automatically customizable
120
+ # spec types.
121
+ #
122
+ # See: register_spec_type and spec_type
123
+ #
124
+ TYPES: Array[Array[Regexp | singleton(Minitest::BenchSpec)] | Array[Regexp | singleton(Minitest::Spec)]]
125
+ end
@@ -0,0 +1,10 @@
1
+ # <!-- rdoc-file=lib/minitest/spec.rb -->
2
+ # Minitest::Spec -- The faster, better, less-magical spec framework!
3
+ #
4
+ # For a list of expectations, see Minitest::Expectations.
5
+ #
6
+ class Minitest::Spec < ::Minitest::Test
7
+ def self.current: () -> untyped
8
+ def initialize: (untyped name) -> void
9
+ include Minitest::Spec::DSL::InstanceMethods
10
+ end
@@ -0,0 +1,76 @@
1
+ # <!-- rdoc-file=lib/minitest.rb -->
2
+ # A reporter that gathers statistics about a test run. Does not do any IO
3
+ # because meant to be used as a parent class for a reporter that does.
4
+ #
5
+ # If you want to create an entirely different type of output (eg, CI, HTML,
6
+ # etc), this is the place to start.
7
+ #
8
+ # Example:
9
+ #
10
+ # class JenkinsCIReporter < StatisticsReporter
11
+ # def report
12
+ # super # Needed to calculate some statistics
13
+ #
14
+ # print "<testsuite "
15
+ # print "tests='#{count}' "
16
+ # print "failures='#{failures}' "
17
+ # # Remaining XML...
18
+ # end
19
+ # end
20
+ #
21
+ class Minitest::StatisticsReporter < ::Minitest::Reporter
22
+ def initialize: (?untyped io, ?::Hash[untyped, untyped] options) -> void
23
+ def passed?: () -> untyped
24
+ def start: () -> untyped
25
+ def record: (untyped result) -> untyped
26
+
27
+ # <!--
28
+ # rdoc-file=lib/minitest.rb
29
+ # - report()
30
+ # -->
31
+ # Report on the tracked statistics.
32
+ #
33
+ def report: () -> untyped
34
+
35
+ # <!-- rdoc-file=lib/minitest.rb -->
36
+ # Total number of assertions.
37
+ #
38
+ attr_accessor assertions: untyped
39
+
40
+ # <!-- rdoc-file=lib/minitest.rb -->
41
+ # Total number of test cases.
42
+ #
43
+ attr_accessor count: untyped
44
+
45
+ # <!-- rdoc-file=lib/minitest.rb -->
46
+ # An `Array` of test cases that failed or were skipped.
47
+ #
48
+ attr_accessor results: untyped
49
+
50
+ # <!-- rdoc-file=lib/minitest.rb -->
51
+ # Time the test run started. If available, the monotonic clock is used and this
52
+ # is a `Float`, otherwise it's an instance of `Time`.
53
+ #
54
+ attr_accessor start_time: untyped
55
+
56
+ # <!-- rdoc-file=lib/minitest.rb -->
57
+ # Test run time. If available, the monotonic clock is used and this is a
58
+ # `Float`, otherwise it's an instance of `Time`.
59
+ #
60
+ attr_accessor total_time: untyped
61
+
62
+ # <!-- rdoc-file=lib/minitest.rb -->
63
+ # Total number of tests that failed.
64
+ #
65
+ attr_accessor failures: untyped
66
+
67
+ # <!-- rdoc-file=lib/minitest.rb -->
68
+ # Total number of tests that erred.
69
+ #
70
+ attr_accessor errors: untyped
71
+
72
+ # <!-- rdoc-file=lib/minitest.rb -->
73
+ # Total number of tests that where skipped.
74
+ #
75
+ attr_accessor skips: untyped
76
+ end
@@ -0,0 +1,26 @@
1
+ # <!-- rdoc-file=lib/minitest.rb -->
2
+ # A reporter that prints the header, summary, and failure details at the end of
3
+ # the run.
4
+ #
5
+ # This is added to the top-level CompositeReporter at the start of the run. If
6
+ # you want to change the output of minitest via a plugin, pull this out of the
7
+ # composite and replace it with your own.
8
+ #
9
+ class Minitest::SummaryReporter < ::Minitest::StatisticsReporter
10
+ def start: () -> untyped
11
+ def report: () -> untyped
12
+ def statistics: () -> untyped
13
+ def aggregated_results: (untyped io) -> untyped
14
+ def to_s: () -> untyped
15
+ def summary: () -> untyped
16
+ private
17
+
18
+ # <!--
19
+ # rdoc-file=lib/minitest.rb
20
+ # - binary_string()
21
+ # -->
22
+ #
23
+ def binary_string: () -> untyped
24
+ attr_accessor sync: untyped
25
+ attr_accessor old_sync: untyped
26
+ end
@@ -0,0 +1,92 @@
1
+ # <!-- rdoc-file=lib/minitest/test.rb -->
2
+ # Provides before/after hooks for setup and teardown. These are meant for
3
+ # library writers, NOT for regular test authors. See #before_setup for an
4
+ # example.
5
+ #
6
+ module Minitest::Test::LifecycleHooks
7
+ # <!--
8
+ # rdoc-file=lib/minitest/test.rb
9
+ # - before_setup()
10
+ # -->
11
+ # Runs before every test, before setup. This hook is meant for libraries to
12
+ # extend minitest. It is not meant to be used by test developers.
13
+ #
14
+ # As a simplistic example:
15
+ #
16
+ # module MyMinitestPlugin
17
+ # def before_setup
18
+ # super
19
+ # # ... stuff to do before setup is run
20
+ # end
21
+ #
22
+ # def after_setup
23
+ # # ... stuff to do after setup is run
24
+ # super
25
+ # end
26
+ #
27
+ # def before_teardown
28
+ # super
29
+ # # ... stuff to do before teardown is run
30
+ # end
31
+ #
32
+ # def after_teardown
33
+ # # ... stuff to do after teardown is run
34
+ # super
35
+ # end
36
+ # end
37
+ #
38
+ # class MiniTest::Test
39
+ # include MyMinitestPlugin
40
+ # end
41
+ #
42
+ def before_setup: () -> nil
43
+
44
+ # <!--
45
+ # rdoc-file=lib/minitest/test.rb
46
+ # - setup()
47
+ # -->
48
+ # Runs before every test. Use this to set up before each test run.
49
+ #
50
+ def setup: () -> nil
51
+
52
+ # <!--
53
+ # rdoc-file=lib/minitest/test.rb
54
+ # - after_setup()
55
+ # -->
56
+ # Runs before every test, after setup. This hook is meant for libraries to
57
+ # extend minitest. It is not meant to be used by test developers.
58
+ #
59
+ # See #before_setup for an example.
60
+ #
61
+ def after_setup: () -> nil
62
+
63
+ # <!--
64
+ # rdoc-file=lib/minitest/test.rb
65
+ # - before_teardown()
66
+ # -->
67
+ # Runs after every test, before teardown. This hook is meant for libraries to
68
+ # extend minitest. It is not meant to be used by test developers.
69
+ #
70
+ # See #before_setup for an example.
71
+ #
72
+ def before_teardown: () -> nil
73
+
74
+ # <!--
75
+ # rdoc-file=lib/minitest/test.rb
76
+ # - teardown()
77
+ # -->
78
+ # Runs after every test. Use this to clean up after each test run.
79
+ #
80
+ def teardown: () -> nil
81
+
82
+ # <!--
83
+ # rdoc-file=lib/minitest/test.rb
84
+ # - after_teardown()
85
+ # -->
86
+ # Runs after every test, after teardown. This hook is meant for libraries to
87
+ # extend minitest. It is not meant to be used by test developers.
88
+ #
89
+ # See #before_setup for an example.
90
+ #
91
+ def after_teardown: () -> nil
92
+ end
@@ -0,0 +1,76 @@
1
+ # <!-- rdoc-file=lib/minitest/test.rb -->
2
+ # Subclass Test to create your own tests. Typically you'll want a Test subclass
3
+ # per implementation class.
4
+ #
5
+ # See Minitest::Assertions
6
+ #
7
+ class Minitest::Test < ::Minitest::Runnable
8
+ def class_name: () -> untyped
9
+
10
+ # <!--
11
+ # rdoc-file=lib/minitest/test.rb
12
+ # - i_suck_and_my_tests_are_order_dependent!()
13
+ # -->
14
+ # Call this at the top of your tests when you absolutely positively need to have
15
+ # ordered tests. In doing so, you're admitting that you suck and your tests are
16
+ # weak.
17
+ #
18
+ def self.i_suck_and_my_tests_are_order_dependent!: () -> untyped
19
+
20
+ # <!--
21
+ # rdoc-file=lib/minitest/test.rb
22
+ # - make_my_diffs_pretty!()
23
+ # -->
24
+ # Make diffs for this Test use #pretty_inspect so that diff in assert_equal can
25
+ # have more details. NOTE: this is much slower than the regular inspect but much
26
+ # more usable for complex objects.
27
+ #
28
+ def self.make_my_diffs_pretty!: () -> untyped
29
+
30
+ # <!--
31
+ # rdoc-file=lib/minitest/test.rb
32
+ # - parallelize_me!()
33
+ # -->
34
+ # Call this at the top of your tests when you want to run your tests in
35
+ # parallel. In doing so, you're admitting that you rule and your tests are
36
+ # awesome.
37
+ #
38
+ def self.parallelize_me!: () -> untyped
39
+
40
+ # <!--
41
+ # rdoc-file=lib/minitest/test.rb
42
+ # - runnable_methods()
43
+ # -->
44
+ # Returns all instance methods starting with "test_". Based on #test_order, the
45
+ # methods are either sorted, randomized (default), or run in parallel.
46
+ #
47
+ def self.runnable_methods: () -> untyped
48
+
49
+ # <!--
50
+ # rdoc-file=lib/minitest/test.rb
51
+ # - test_order()
52
+ # -->
53
+ # Defines the order to run tests (:random by default). Override this or use a
54
+ # convenience method to change it for your tests.
55
+ #
56
+ def self.test_order: () -> :random
57
+
58
+ # <!--
59
+ # rdoc-file=lib/minitest/test.rb
60
+ # - run()
61
+ # -->
62
+ # Runs a single test with setup/teardown hooks.
63
+ #
64
+ def run: () -> untyped
65
+ def capture_exceptions: () { () -> untyped } -> untyped
66
+ def sanitize_exception: (untyped e) -> untyped
67
+ def with_info_handler: () { () -> untyped } -> untyped
68
+ attr_accessor self.io_lock: untyped
69
+ include Minitest::Assertions
70
+ include Minitest::Reportable
71
+ include Minitest::Test::LifecycleHooks
72
+ include Minitest::Guard
73
+ extend Minitest::Guard
74
+ TEARDOWN_METHODS: Array[String]
75
+ PASSTHROUGH_EXCEPTIONS: Array[singleton(NoMemoryError) | singleton(SignalException) | singleton(SystemExit)]
76
+ end
@@ -0,0 +1,10 @@
1
+ # <!-- rdoc-file=lib/minitest.rb -->
2
+ # Assertion wrapping an unexpected error that was raised during a run.
3
+ #
4
+ class Minitest::UnexpectedError < ::Minitest::Assertion
5
+ def initialize: (untyped error) -> void
6
+ def backtrace: () -> untyped
7
+ def message: () -> ::String
8
+ def result_label: () -> "Error"
9
+ attr_accessor error: untyped
10
+ end
@@ -0,0 +1,3 @@
1
+ class Minitest::Unit::TestCase < ::Minitest::Test
2
+ def self.inherited: (untyped klass) -> untyped
3
+ end
@@ -0,0 +1,5 @@
1
+ class Minitest::Unit
2
+ def self.autorun: () -> untyped
3
+ def self.after_tests: () { () -> untyped } -> untyped
4
+ VERSION: String
5
+ end