type_toolkit 0.0.4 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +45 -1
  3. data/benchmark/.rubocop.yml +7 -0
  4. data/benchmark/abstract_methods_benchmark.rb +221 -0
  5. data/benchmark/interface_startup_performance.rb +128 -0
  6. data/benchmark/module_benchmark.rb +62 -0
  7. data/config/default.yml +5 -0
  8. data/docs/design/inherited_implementation_problem.md +119 -0
  9. data/docs/design/self_dot_methods.md +79 -0
  10. data/lib/rubocop/cop/type_toolkit/plugin.rb +2 -1
  11. data/lib/rubocop/cop/type_toolkit/prefer_not_nil.rb +96 -0
  12. data/lib/rubocop-type_toolkit.rb +1 -0
  13. data/lib/type_toolkit/abstract_method_receiver.rb +39 -0
  14. data/lib/type_toolkit/dsl.rb +64 -0
  15. data/lib/type_toolkit/ext/method.rb +11 -0
  16. data/lib/type_toolkit/ext/module.rb +7 -0
  17. data/lib/type_toolkit/ext/nil_assertions.rb +3 -1
  18. data/lib/type_toolkit/has_abstract_methods.rb +108 -0
  19. data/lib/type_toolkit/interface.rb +38 -0
  20. data/lib/type_toolkit/method_def_recorder.rb +53 -0
  21. data/lib/type_toolkit/method_patch.rb +16 -0
  22. data/lib/type_toolkit/version.rb +1 -1
  23. data/lib/type_toolkit.rb +3 -0
  24. data/sorbet/config +3 -1
  25. data/sorbet/rbi/gems/benchmark-ips@2.14.0.rbi +981 -0
  26. data/sorbet/rbi/gems/{erb@6.0.1.rbi → erb@6.0.1.1.rbi} +2 -2
  27. data/sorbet/rbi/gems/{json@2.18.1.rbi → json@2.19.9.rbi} +115 -161
  28. data/sorbet/rbi/gems/minitest@5.27.0.rbi +707 -0
  29. data/sorbet/rbi/gems/rexml@3.4.4.rbi +0 -167
  30. data/sorbet/rbi/gems/rubocop-ast@1.49.0.rbi +6 -0
  31. data/sorbet/rbi/gems/rubocop@1.84.2.rbi +7 -0
  32. data/sorbet/rbi/gems/tapioca@0.17.10.rbi +1 -0
  33. data/sorbet/rbi/gems/{yard@0.9.38.rbi → yard@0.9.44.rbi} +1206 -241
  34. data/sorbet/rbi/shims/core.rbi +19 -0
  35. data/sorbet/rbi/shims/minitest.rbi +5 -2
  36. data/spec/interface_spec.rb +405 -0
  37. data/spec/rubocop/cop/type_toolkit/prefer_not_nil_spec.rb +229 -0
  38. data/spec/spec_helper.rb +14 -0
  39. metadata +23 -4
@@ -5,6 +5,50 @@
5
5
  # Please instead update this file by running `bin/tapioca gem minitest`.
6
6
 
7
7
 
8
+ # Kernel extensions for minitest
9
+ #
10
+ # source://minitest//lib/minitest/spec.rb#50
11
+ module Kernel
12
+ private
13
+
14
+ # Describe a series of expectations for a given target +desc+.
15
+ #
16
+ # Defines a test class subclassing from either Minitest::Spec or
17
+ # from the surrounding describe's class. The surrounding class may
18
+ # subclass Minitest::Spec manually in order to easily share code:
19
+ #
20
+ # class MySpec < Minitest::Spec
21
+ # # ... shared code ...
22
+ # end
23
+ #
24
+ # class TestStuff < MySpec
25
+ # it "does stuff" do
26
+ # # shared code available here
27
+ # end
28
+ # describe "inner stuff" do
29
+ # it "still does stuff" do
30
+ # # ...and here
31
+ # end
32
+ # end
33
+ # end
34
+ #
35
+ # For more information on getting started with writing specs, see:
36
+ #
37
+ # http://www.rubyinside.com/a-minitestspec-tutorial-elegant-spec-style-testing-that-comes-with-ruby-5354.html
38
+ #
39
+ # For some suggestions on how to improve your specs, try:
40
+ #
41
+ # https://betterspecs.org
42
+ #
43
+ # but do note that several items there are debatable or specific to
44
+ # rspec.
45
+ #
46
+ # For more information about expectations, see Minitest::Expectations.
47
+ #
48
+ # source://minitest//lib/minitest/spec.rb#86
49
+ def describe(desc, *additional_desc, &block); end
50
+ end
51
+
8
52
  # The top-level namespace for Minitest. Also the location of the main
9
53
  # runtime. See +Minitest.run+ for more information.
10
54
  #
@@ -272,6 +316,11 @@ module Minitest::Assertions
272
316
  # source://minitest//lib/minitest/assertions.rb#293
273
317
  def assert_match(matcher, obj, msg = T.unsafe(nil)); end
274
318
 
319
+ # Assert that the mock verifies correctly and fail if not.
320
+ #
321
+ # source://minitest//lib/minitest/mock.rb#241
322
+ def assert_mock(mock, msg = T.unsafe(nil)); end
323
+
275
324
  # Fails unless +obj+ is nil
276
325
  #
277
326
  # source://minitest//lib/minitest/assertions.rb#305
@@ -719,6 +768,289 @@ module Minitest::Compress
719
768
  def compress(orig); end
720
769
  end
721
770
 
771
+ # fucking hell rdoc...
772
+ #
773
+ # source://minitest//lib/minitest/spec.rb#43
774
+ class Minitest::Expectation < ::Struct
775
+ # Returns the value of attribute ctx
776
+ #
777
+ # @return [Object] the current value of ctx
778
+ #
779
+ # source://minitest//lib/minitest/spec.rb#43
780
+ def ctx; end
781
+
782
+ # Sets the attribute ctx
783
+ #
784
+ # @param value [Object] the value to set the attribute ctx to.
785
+ # @return [Object] the newly set value
786
+ #
787
+ # source://minitest//lib/minitest/spec.rb#43
788
+ def ctx=(_); end
789
+
790
+ # source://minitest//lib/minitest/expectations.rb#116
791
+ def must_be(*args, **_arg1); end
792
+
793
+ # source://minitest//lib/minitest/expectations.rb#47
794
+ def must_be_close_to(*args, **_arg1); end
795
+
796
+ # source://minitest//lib/minitest/expectations.rb#29
797
+ def must_be_empty(*args, **_arg1); end
798
+
799
+ # source://minitest//lib/minitest/expectations.rb#76
800
+ def must_be_instance_of(*args, **_arg1); end
801
+
802
+ # source://minitest//lib/minitest/expectations.rb#85
803
+ def must_be_kind_of(*args, **_arg1); end
804
+
805
+ # source://minitest//lib/minitest/expectations.rb#103
806
+ def must_be_nil(*args, **_arg1); end
807
+
808
+ # source://minitest//lib/minitest/expectations.rb#161
809
+ def must_be_same_as(*args, **_arg1); end
810
+
811
+ # source://minitest//lib/minitest/expectations.rb#170
812
+ def must_be_silent(*args, **_arg1); end
813
+
814
+ # source://minitest//lib/minitest/expectations.rb#49
815
+ def must_be_within_delta(*args, **_arg1); end
816
+
817
+ # source://minitest//lib/minitest/expectations.rb#58
818
+ def must_be_within_epsilon(*args, **_arg1); end
819
+
820
+ # source://minitest//lib/minitest/expectations.rb#38
821
+ def must_equal(*args, **_arg1); end
822
+
823
+ # source://minitest//lib/minitest/expectations.rb#67
824
+ def must_include(*args, **_arg1); end
825
+
826
+ # source://minitest//lib/minitest/expectations.rb#94
827
+ def must_match(*args, **_arg1); end
828
+
829
+ # source://minitest//lib/minitest/expectations.rb#125
830
+ def must_output(*args, **_arg1); end
831
+
832
+ # source://minitest//lib/minitest/expectations.rb#134
833
+ def must_pattern_match(*args, **_arg1); end
834
+
835
+ # source://minitest//lib/minitest/expectations.rb#143
836
+ def must_raise(*args, **_arg1); end
837
+
838
+ # source://minitest//lib/minitest/expectations.rb#152
839
+ def must_respond_to(*args, **_arg1); end
840
+
841
+ # source://minitest//lib/minitest/expectations.rb#179
842
+ def must_throw(*args, **_arg1); end
843
+
844
+ # source://minitest//lib/minitest/mock.rb#257
845
+ def must_verify(*args, **_arg1); end
846
+
847
+ # source://minitest//lib/minitest/expectations.rb#188
848
+ def path_must_exist(*args, **_arg1); end
849
+
850
+ # source://minitest//lib/minitest/expectations.rb#197
851
+ def path_wont_exist(*args, **_arg1); end
852
+
853
+ # Returns the value of attribute target
854
+ #
855
+ # @return [Object] the current value of target
856
+ #
857
+ # source://minitest//lib/minitest/spec.rb#43
858
+ def target; end
859
+
860
+ # Sets the attribute target
861
+ #
862
+ # @param value [Object] the value to set the attribute target to.
863
+ # @return [Object] the newly set value
864
+ #
865
+ # source://minitest//lib/minitest/spec.rb#43
866
+ def target=(_); end
867
+
868
+ # source://minitest//lib/minitest/expectations.rb#293
869
+ def wont_be(*args, **_arg1); end
870
+
871
+ # source://minitest//lib/minitest/expectations.rb#224
872
+ def wont_be_close_to(*args, **_arg1); end
873
+
874
+ # source://minitest//lib/minitest/expectations.rb#206
875
+ def wont_be_empty(*args, **_arg1); end
876
+
877
+ # source://minitest//lib/minitest/expectations.rb#253
878
+ def wont_be_instance_of(*args, **_arg1); end
879
+
880
+ # source://minitest//lib/minitest/expectations.rb#262
881
+ def wont_be_kind_of(*args, **_arg1); end
882
+
883
+ # source://minitest//lib/minitest/expectations.rb#280
884
+ def wont_be_nil(*args, **_arg1); end
885
+
886
+ # source://minitest//lib/minitest/expectations.rb#320
887
+ def wont_be_same_as(*args, **_arg1); end
888
+
889
+ # source://minitest//lib/minitest/expectations.rb#226
890
+ def wont_be_within_delta(*args, **_arg1); end
891
+
892
+ # source://minitest//lib/minitest/expectations.rb#235
893
+ def wont_be_within_epsilon(*args, **_arg1); end
894
+
895
+ # source://minitest//lib/minitest/expectations.rb#215
896
+ def wont_equal(*args, **_arg1); end
897
+
898
+ # source://minitest//lib/minitest/expectations.rb#244
899
+ def wont_include(*args, **_arg1); end
900
+
901
+ # source://minitest//lib/minitest/expectations.rb#271
902
+ def wont_match(*args, **_arg1); end
903
+
904
+ # source://minitest//lib/minitest/expectations.rb#302
905
+ def wont_pattern_match(*args, **_arg1); end
906
+
907
+ # source://minitest//lib/minitest/expectations.rb#311
908
+ def wont_respond_to(*args, **_arg1); end
909
+
910
+ class << self
911
+ # source://minitest//lib/minitest/spec.rb#43
912
+ def [](*_arg0); end
913
+
914
+ # source://minitest//lib/minitest/spec.rb#43
915
+ def inspect; end
916
+
917
+ # source://minitest//lib/minitest/spec.rb#43
918
+ def keyword_init?; end
919
+
920
+ # source://minitest//lib/minitest/spec.rb#43
921
+ def members; end
922
+
923
+ # source://minitest//lib/minitest/spec.rb#43
924
+ def new(*_arg0); end
925
+ end
926
+ end
927
+
928
+ # It's where you hide your "assertions".
929
+ #
930
+ # Please note, because of the way that expectations are implemented,
931
+ # all expectations (eg must_equal) are dependent upon a thread local
932
+ # variable +:current_spec+. If your specs rely on mixing threads into
933
+ # the specs themselves, you're better off using assertions or the new
934
+ # _(value) wrapper. For example:
935
+ #
936
+ # it "should still work in threads" do
937
+ # my_threaded_thingy do
938
+ # (1+1).must_equal 2 # bad
939
+ # assert_equal 2, 1+1 # good
940
+ # _(1 + 1).must_equal 2 # good
941
+ # value(1 + 1).must_equal 2 # good, also #expect
942
+ # _ { 1 + "1" }.must_raise TypeError # good
943
+ # end
944
+ # end
945
+ #
946
+ # source://minitest//lib/minitest/expectations.rb#20
947
+ module Minitest::Expectations
948
+ # source://minitest//lib/minitest/expectations.rb#116
949
+ def must_be(*args, **_arg1); end
950
+
951
+ # source://minitest//lib/minitest/expectations.rb#47
952
+ def must_be_close_to(*args, **_arg1); end
953
+
954
+ # source://minitest//lib/minitest/expectations.rb#29
955
+ def must_be_empty(*args, **_arg1); end
956
+
957
+ # source://minitest//lib/minitest/expectations.rb#76
958
+ def must_be_instance_of(*args, **_arg1); end
959
+
960
+ # source://minitest//lib/minitest/expectations.rb#85
961
+ def must_be_kind_of(*args, **_arg1); end
962
+
963
+ # source://minitest//lib/minitest/expectations.rb#103
964
+ def must_be_nil(*args, **_arg1); end
965
+
966
+ # source://minitest//lib/minitest/expectations.rb#161
967
+ def must_be_same_as(*args, **_arg1); end
968
+
969
+ # source://minitest//lib/minitest/expectations.rb#170
970
+ def must_be_silent(*args, **_arg1); end
971
+
972
+ # source://minitest//lib/minitest/expectations.rb#49
973
+ def must_be_within_delta(*args, **_arg1); end
974
+
975
+ # source://minitest//lib/minitest/expectations.rb#58
976
+ def must_be_within_epsilon(*args, **_arg1); end
977
+
978
+ # source://minitest//lib/minitest/expectations.rb#38
979
+ def must_equal(*args, **_arg1); end
980
+
981
+ # source://minitest//lib/minitest/expectations.rb#67
982
+ def must_include(*args, **_arg1); end
983
+
984
+ # source://minitest//lib/minitest/expectations.rb#94
985
+ def must_match(*args, **_arg1); end
986
+
987
+ # source://minitest//lib/minitest/expectations.rb#125
988
+ def must_output(*args, **_arg1); end
989
+
990
+ # source://minitest//lib/minitest/expectations.rb#134
991
+ def must_pattern_match(*args, **_arg1); end
992
+
993
+ # source://minitest//lib/minitest/expectations.rb#143
994
+ def must_raise(*args, **_arg1); end
995
+
996
+ # source://minitest//lib/minitest/expectations.rb#152
997
+ def must_respond_to(*args, **_arg1); end
998
+
999
+ # source://minitest//lib/minitest/expectations.rb#179
1000
+ def must_throw(*args, **_arg1); end
1001
+
1002
+ # source://minitest//lib/minitest/mock.rb#257
1003
+ def must_verify(*args, **_arg1); end
1004
+
1005
+ # source://minitest//lib/minitest/expectations.rb#188
1006
+ def path_must_exist(*args, **_arg1); end
1007
+
1008
+ # source://minitest//lib/minitest/expectations.rb#197
1009
+ def path_wont_exist(*args, **_arg1); end
1010
+
1011
+ # source://minitest//lib/minitest/expectations.rb#293
1012
+ def wont_be(*args, **_arg1); end
1013
+
1014
+ # source://minitest//lib/minitest/expectations.rb#224
1015
+ def wont_be_close_to(*args, **_arg1); end
1016
+
1017
+ # source://minitest//lib/minitest/expectations.rb#206
1018
+ def wont_be_empty(*args, **_arg1); end
1019
+
1020
+ # source://minitest//lib/minitest/expectations.rb#253
1021
+ def wont_be_instance_of(*args, **_arg1); end
1022
+
1023
+ # source://minitest//lib/minitest/expectations.rb#262
1024
+ def wont_be_kind_of(*args, **_arg1); end
1025
+
1026
+ # source://minitest//lib/minitest/expectations.rb#280
1027
+ def wont_be_nil(*args, **_arg1); end
1028
+
1029
+ # source://minitest//lib/minitest/expectations.rb#320
1030
+ def wont_be_same_as(*args, **_arg1); end
1031
+
1032
+ # source://minitest//lib/minitest/expectations.rb#226
1033
+ def wont_be_within_delta(*args, **_arg1); end
1034
+
1035
+ # source://minitest//lib/minitest/expectations.rb#235
1036
+ def wont_be_within_epsilon(*args, **_arg1); end
1037
+
1038
+ # source://minitest//lib/minitest/expectations.rb#215
1039
+ def wont_equal(*args, **_arg1); end
1040
+
1041
+ # source://minitest//lib/minitest/expectations.rb#244
1042
+ def wont_include(*args, **_arg1); end
1043
+
1044
+ # source://minitest//lib/minitest/expectations.rb#271
1045
+ def wont_match(*args, **_arg1); end
1046
+
1047
+ # source://minitest//lib/minitest/expectations.rb#302
1048
+ def wont_pattern_match(*args, **_arg1); end
1049
+
1050
+ # source://minitest//lib/minitest/expectations.rb#311
1051
+ def wont_respond_to(*args, **_arg1); end
1052
+ end
1053
+
722
1054
  # Provides a simple set of guards that you can use in your tests
723
1055
  # to skip execution if it is not applicable. These methods are
724
1056
  # mixed into Test as both instance and class methods so you
@@ -778,6 +1110,107 @@ module Minitest::Guard
778
1110
  def windows?(platform = T.unsafe(nil)); end
779
1111
  end
780
1112
 
1113
+ # A simple and clean mock object framework.
1114
+ #
1115
+ # All mock objects are an instance of Mock
1116
+ #
1117
+ # source://minitest//lib/minitest/mock.rb#10
1118
+ class Minitest::Mock
1119
+ # @return [Mock] a new instance of Mock
1120
+ #
1121
+ # source://minitest//lib/minitest/mock.rb#45
1122
+ def initialize(delegator = T.unsafe(nil)); end
1123
+
1124
+ # source://minitest//lib/minitest/mock.rb#34
1125
+ def ===(*args, **kwargs, &b); end
1126
+
1127
+ # source://minitest//lib/minitest/mock.rb#117
1128
+ def __call(name, data); end
1129
+
1130
+ # source://minitest//lib/minitest/mock.rb#11
1131
+ def __respond_to?(*_arg0); end
1132
+
1133
+ # source://minitest//lib/minitest/mock.rb#34
1134
+ def class(*args, **kwargs, &b); end
1135
+
1136
+ # Expect that method +name+ is called, optionally with +args+ (and
1137
+ # +kwargs+ or a +blk+), and returns +retval+.
1138
+ #
1139
+ # @mock.expect(:meaning_of_life, 42)
1140
+ # @mock.meaning_of_life # => 42
1141
+ #
1142
+ # @mock.expect(:do_something_with, true, [some_obj, true])
1143
+ # @mock.do_something_with(some_obj, true) # => true
1144
+ #
1145
+ # @mock.expect(:do_something_else, true) do |a1, a2|
1146
+ # a1 == "buggs" && a2 == :bunny
1147
+ # end
1148
+ #
1149
+ # +args+ is compared to the expected args using case equality (ie, the
1150
+ # '===' operator), allowing for less specific expectations.
1151
+ #
1152
+ # @mock.expect(:uses_any_string, true, [String])
1153
+ # @mock.uses_any_string("foo") # => true
1154
+ # @mock.verify # => true
1155
+ #
1156
+ # @mock.expect(:uses_one_string, true, ["foo"])
1157
+ # @mock.uses_one_string("bar") # => raises MockExpectationError
1158
+ #
1159
+ # If a method will be called multiple times, specify a new expect for each one.
1160
+ # They will be used in the order you define them.
1161
+ #
1162
+ # @mock.expect(:ordinal_increment, 'first')
1163
+ # @mock.expect(:ordinal_increment, 'second')
1164
+ #
1165
+ # @mock.ordinal_increment # => 'first'
1166
+ # @mock.ordinal_increment # => 'second'
1167
+ # @mock.ordinal_increment # => raises MockExpectationError "No more expects available for :ordinal_increment"
1168
+ #
1169
+ # source://minitest//lib/minitest/mock.rb#88
1170
+ def expect(name, retval, args = T.unsafe(nil), **kwargs, &blk); end
1171
+
1172
+ # source://minitest//lib/minitest/mock.rb#34
1173
+ def inspect(*args, **kwargs, &b); end
1174
+
1175
+ # source://minitest//lib/minitest/mock.rb#34
1176
+ def instance_eval(*args, **kwargs, &b); end
1177
+
1178
+ # source://minitest//lib/minitest/mock.rb#34
1179
+ def instance_variables(*args, **kwargs, &b); end
1180
+
1181
+ # source://minitest//lib/minitest/mock.rb#147
1182
+ def method_missing(sym, *args, **kwargs, &block); end
1183
+
1184
+ # source://minitest//lib/minitest/mock.rb#34
1185
+ def object_id(*args, **kwargs, &b); end
1186
+
1187
+ # source://minitest//lib/minitest/mock.rb#34
1188
+ def public_send(*args, **kwargs, &b); end
1189
+
1190
+ # @return [Boolean]
1191
+ #
1192
+ # source://minitest//lib/minitest/mock.rb#229
1193
+ def respond_to?(sym, include_private = T.unsafe(nil)); end
1194
+
1195
+ # source://minitest//lib/minitest/mock.rb#34
1196
+ def send(*args, **kwargs, &b); end
1197
+
1198
+ # source://minitest//lib/minitest/mock.rb#34
1199
+ def to_s(*args, **kwargs, &b); end
1200
+
1201
+ # Verify that all methods were called as expected. Raises
1202
+ # +MockExpectationError+ if the mock object was not called as
1203
+ # expected.
1204
+ #
1205
+ # source://minitest//lib/minitest/mock.rb#137
1206
+ def verify; end
1207
+
1208
+ private
1209
+
1210
+ # source://minitest//lib/minitest/mock.rb#34
1211
+ def respond_to_missing?(*args, **kwargs, &b); end
1212
+ end
1213
+
781
1214
  # source://minitest//lib/minitest/parallel.rb#4
782
1215
  module Minitest::Parallel; end
783
1216
 
@@ -1152,6 +1585,242 @@ class Minitest::Skip < ::Minitest::Assertion
1152
1585
  def result_label; end
1153
1586
  end
1154
1587
 
1588
+ # Minitest::Spec -- The faster, better, less-magical spec framework!
1589
+ #
1590
+ # For a list of expectations, see Minitest::Expectations.
1591
+ #
1592
+ # source://minitest//lib/minitest/spec.rb#111
1593
+ class Minitest::Spec < ::Minitest::Test
1594
+ include ::Minitest::Spec::DSL::InstanceMethods
1595
+ extend ::Minitest::Spec::DSL
1596
+
1597
+ # @return [Spec] a new instance of Spec
1598
+ #
1599
+ # source://minitest//lib/minitest/spec.rb#117
1600
+ def initialize(name); end
1601
+
1602
+ class << self
1603
+ # source://minitest//lib/minitest/spec.rb#113
1604
+ def current; end
1605
+ end
1606
+ end
1607
+
1608
+ # Oh look! A Minitest::Spec::DSL module! Eat your heart out DHH.
1609
+ #
1610
+ # source://minitest//lib/minitest/spec.rb#125
1611
+ module Minitest::Spec::DSL
1612
+ # Define an 'after' action. Inherits the way normal methods should.
1613
+ #
1614
+ # NOTE: +type+ is ignored and is only there to make porting easier.
1615
+ #
1616
+ # Equivalent to Minitest::Test#teardown.
1617
+ #
1618
+ # source://minitest//lib/minitest/spec.rb#210
1619
+ def after(_type = T.unsafe(nil), &block); end
1620
+
1621
+ # Define a 'before' action. Inherits the way normal methods should.
1622
+ #
1623
+ # NOTE: +type+ is ignored and is only there to make porting easier.
1624
+ #
1625
+ # Equivalent to Minitest::Test#setup.
1626
+ #
1627
+ # source://minitest//lib/minitest/spec.rb#196
1628
+ def before(_type = T.unsafe(nil), &block); end
1629
+
1630
+ # source://minitest//lib/minitest/spec.rb#179
1631
+ def children; end
1632
+
1633
+ # source://minitest//lib/minitest/spec.rb#275
1634
+ def create(name, desc); end
1635
+
1636
+ # source://minitest//lib/minitest/spec.rb#295
1637
+ def desc; end
1638
+
1639
+ # source://minitest//lib/minitest/spec.rb#175
1640
+ def describe_stack; end
1641
+
1642
+ # source://minitest//lib/minitest/spec.rb#293
1643
+ def inspect; end
1644
+
1645
+ # Define an expectation with name +desc+. Name gets morphed to a
1646
+ # proper test method name. For some freakish reason, people who
1647
+ # write specs don't like class inheritance, so this goes way out of
1648
+ # its way to make sure that expectations aren't inherited.
1649
+ #
1650
+ # This is also aliased to #specify and doesn't require a +desc+ arg.
1651
+ #
1652
+ # Hint: If you _do_ want inheritance, use minitest/test. You can mix
1653
+ # and match between assertions and expectations as much as you want.
1654
+ #
1655
+ # source://minitest//lib/minitest/spec.rb#228
1656
+ def it(desc = T.unsafe(nil), &block); end
1657
+
1658
+ # Essentially, define an accessor for +name+ with +block+.
1659
+ #
1660
+ # Why use let instead of def? I honestly don't know.
1661
+ #
1662
+ # @raise [ArgumentError]
1663
+ #
1664
+ # source://minitest//lib/minitest/spec.rb#252
1665
+ def let(name, &block); end
1666
+
1667
+ # source://minitest//lib/minitest/spec.rb#288
1668
+ def name; end
1669
+
1670
+ # source://minitest//lib/minitest/spec.rb#183
1671
+ def nuke_test_methods!; end
1672
+
1673
+ # Register a new type of spec that matches the spec's description.
1674
+ # This method can take either a Regexp and a spec class or a spec
1675
+ # class and a block that takes the description and returns true if
1676
+ # it matches.
1677
+ #
1678
+ # Eg:
1679
+ #
1680
+ # register_spec_type(/Controller$/, Minitest::Spec::Rails)
1681
+ #
1682
+ # or:
1683
+ #
1684
+ # register_spec_type(Minitest::Spec::RailsModel) do |desc|
1685
+ # desc.superclass == ActiveRecord::Base
1686
+ # end
1687
+ #
1688
+ # source://minitest//lib/minitest/spec.rb#151
1689
+ def register_spec_type(*args, &block); end
1690
+
1691
+ # Figure out the spec class to use based on a spec's description. Eg:
1692
+ #
1693
+ # spec_type("BlahController") # => Minitest::Spec::Rails
1694
+ #
1695
+ # source://minitest//lib/minitest/spec.rb#165
1696
+ def spec_type(desc, *additional); end
1697
+
1698
+ # Define an expectation with name +desc+. Name gets morphed to a
1699
+ # proper test method name. For some freakish reason, people who
1700
+ # write specs don't like class inheritance, so this goes way out of
1701
+ # its way to make sure that expectations aren't inherited.
1702
+ #
1703
+ # This is also aliased to #specify and doesn't require a +desc+ arg.
1704
+ #
1705
+ # Hint: If you _do_ want inheritance, use minitest/test. You can mix
1706
+ # and match between assertions and expectations as much as you want.
1707
+ #
1708
+ # source://minitest//lib/minitest/spec.rb#296
1709
+ def specify(desc = T.unsafe(nil), &block); end
1710
+
1711
+ # Another lazy man's accessor generator. Made even more lazy by
1712
+ # setting the name for you to +subject+.
1713
+ #
1714
+ # source://minitest//lib/minitest/spec.rb#271
1715
+ def subject(&block); end
1716
+
1717
+ # source://minitest//lib/minitest/spec.rb#292
1718
+ def to_s; end
1719
+
1720
+ class << self
1721
+ # source://minitest//lib/minitest/spec.rb#339
1722
+ def extended(obj); end
1723
+ end
1724
+ end
1725
+
1726
+ # Rdoc... why are you so dumb?
1727
+ #
1728
+ # source://minitest//lib/minitest/spec.rb#301
1729
+ module Minitest::Spec::DSL::InstanceMethods
1730
+ # Takes a value or a block and returns a value monad that has
1731
+ # all of Expectations methods available to it.
1732
+ #
1733
+ # _(1 + 1).must_equal 2
1734
+ #
1735
+ # And for blocks:
1736
+ #
1737
+ # _ { 1 + "1" }.must_raise TypeError
1738
+ #
1739
+ # This method of expectation-based testing is preferable to
1740
+ # straight-expectation methods (on Object) because it stores its
1741
+ # test context, bypassing our hacky use of thread-local variables.
1742
+ #
1743
+ # NOTE: At some point, the methods on Object will be deprecated
1744
+ # and then removed.
1745
+ #
1746
+ # It is also aliased to #value and #expect for your aesthetic
1747
+ # pleasure:
1748
+ #
1749
+ # _(1 + 1).must_equal 2
1750
+ # value(1 + 1).must_equal 2
1751
+ # expect(1 + 1).must_equal 2
1752
+ #
1753
+ # source://minitest//lib/minitest/spec.rb#326
1754
+ def _(value = T.unsafe(nil), &block); end
1755
+
1756
+ # source://minitest//lib/minitest/spec.rb#333
1757
+ def before_setup; end
1758
+
1759
+ # Takes a value or a block and returns a value monad that has
1760
+ # all of Expectations methods available to it.
1761
+ #
1762
+ # _(1 + 1).must_equal 2
1763
+ #
1764
+ # And for blocks:
1765
+ #
1766
+ # _ { 1 + "1" }.must_raise TypeError
1767
+ #
1768
+ # This method of expectation-based testing is preferable to
1769
+ # straight-expectation methods (on Object) because it stores its
1770
+ # test context, bypassing our hacky use of thread-local variables.
1771
+ #
1772
+ # NOTE: At some point, the methods on Object will be deprecated
1773
+ # and then removed.
1774
+ #
1775
+ # It is also aliased to #value and #expect for your aesthetic
1776
+ # pleasure:
1777
+ #
1778
+ # _(1 + 1).must_equal 2
1779
+ # value(1 + 1).must_equal 2
1780
+ # expect(1 + 1).must_equal 2
1781
+ #
1782
+ # source://minitest//lib/minitest/spec.rb#331
1783
+ def expect(value = T.unsafe(nil), &block); end
1784
+
1785
+ # Takes a value or a block and returns a value monad that has
1786
+ # all of Expectations methods available to it.
1787
+ #
1788
+ # _(1 + 1).must_equal 2
1789
+ #
1790
+ # And for blocks:
1791
+ #
1792
+ # _ { 1 + "1" }.must_raise TypeError
1793
+ #
1794
+ # This method of expectation-based testing is preferable to
1795
+ # straight-expectation methods (on Object) because it stores its
1796
+ # test context, bypassing our hacky use of thread-local variables.
1797
+ #
1798
+ # NOTE: At some point, the methods on Object will be deprecated
1799
+ # and then removed.
1800
+ #
1801
+ # It is also aliased to #value and #expect for your aesthetic
1802
+ # pleasure:
1803
+ #
1804
+ # _(1 + 1).must_equal 2
1805
+ # value(1 + 1).must_equal 2
1806
+ # expect(1 + 1).must_equal 2
1807
+ #
1808
+ # source://minitest//lib/minitest/spec.rb#330
1809
+ def value(value = T.unsafe(nil), &block); end
1810
+ end
1811
+
1812
+ # Contains pairs of matchers and Spec classes to be used to
1813
+ # calculate the superclass of a top-level describe. This allows for
1814
+ # automatically customizable spec types.
1815
+ #
1816
+ # See: register_spec_type and spec_type
1817
+ #
1818
+ # source://minitest//lib/minitest/spec.rb#133
1819
+ Minitest::Spec::DSL::TYPES = T.let(T.unsafe(nil), Array)
1820
+
1821
+ # source://minitest//lib/minitest/spec.rb#346
1822
+ Minitest::Spec::TYPES = T.let(T.unsafe(nil), Array)
1823
+
1155
1824
  # A reporter that gathers statistics about a test run. Does not do
1156
1825
  # any IO because meant to be used as a parent class for a reporter
1157
1826
  # that does.
@@ -1547,3 +2216,41 @@ end
1547
2216
 
1548
2217
  # source://minitest//lib/minitest.rb#13
1549
2218
  Minitest::VERSION = T.let(T.unsafe(nil), String)
2219
+
2220
+ # source://minitest//lib/minitest/mock.rb#1
2221
+ class MockExpectationError < ::StandardError; end
2222
+
2223
+ # source://minitest//lib/minitest/spec.rb#3
2224
+ class Module
2225
+ # source://minitest//lib/minitest/spec.rb#4
2226
+ def infect_an_assertion(meth, new_name, dont_flip = T.unsafe(nil)); end
2227
+ end
2228
+
2229
+ # source://minitest//lib/minitest/spec.rb#351
2230
+ class Object < ::BasicObject
2231
+ include ::Kernel
2232
+ include ::PP::ObjectMixin
2233
+ include ::Minitest::Expectations
2234
+
2235
+ # Add a temporary stubbed method replacing +name+ for the duration
2236
+ # of the +block+. If +val_or_callable+ responds to #call, then it
2237
+ # returns the result of calling it, otherwise returns the value
2238
+ # as-is. If stubbed method yields a block, +block_args+ will be
2239
+ # passed along. Cleans up the stub at the end of the +block+. The
2240
+ # method +name+ must exist before stubbing.
2241
+ #
2242
+ # def test_stale_eh
2243
+ # obj_under_test = Something.new
2244
+ # refute obj_under_test.stale?
2245
+ #
2246
+ # Time.stub :now, Time.at(0) do
2247
+ # assert obj_under_test.stale?
2248
+ # end
2249
+ # end
2250
+ # --
2251
+ # NOTE: keyword args in callables are NOT checked for correctness
2252
+ # against the existing method. Too many edge cases to be worth it.
2253
+ #
2254
+ # source://minitest//lib/minitest/mock.rb#286
2255
+ def stub(name, val_or_callable, *block_args, **block_kwargs, &block); end
2256
+ end