sorbet-result 0.1.1 → 0.2.0
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/Gemfile.lock +13 -11
- data/README.md +17 -17
- data/lib/sorbet-result.rb +8 -5
- data/lib/{t → typed}/failure.rb +5 -5
- data/lib/{t → typed}/nil_payload_error.rb +2 -2
- data/lib/{t → typed}/no_payload_on_failure_error.rb +2 -2
- data/lib/{t → typed}/result.rb +6 -6
- data/lib/{t → typed}/success.rb +5 -5
- data/sorbet/rbi/gems/minitest@5.18.0.rbi +662 -0
- data/sorbet/rbi/gems/{parallel@1.22.1.rbi → parallel@1.23.0.rbi} +75 -79
- data/sorbet/rbi/gems/rbi@0.0.16.rbi +5 -5
- data/sorbet/rbi/gems/spoom@1.2.1.rbi +14 -14
- data/sorbet/rbi/gems/tapioca@0.11.5.rbi +6 -6
- data/sorbet/rbi/gems/yard-sorbet@0.8.1.rbi +1 -1
- data/sorbet/rbi/gems/zeitwerk@2.6.7.rbi +966 -0
- data/sorbet/tapioca/require.rb +5 -2
- metadata +27 -12
@@ -4,6 +4,50 @@
|
|
4
4
|
# This is an autogenerated file for types exported from the `minitest` gem.
|
5
5
|
# Please instead update this file by running `bin/tapioca gem minitest`.
|
6
6
|
|
7
|
+
# Kernel extensions for minitest
|
8
|
+
#
|
9
|
+
# source://minitest//lib/minitest/spec.rb#46
|
10
|
+
module Kernel
|
11
|
+
private
|
12
|
+
|
13
|
+
# Describe a series of expectations for a given target +desc+.
|
14
|
+
#
|
15
|
+
# Defines a test class subclassing from either Minitest::Spec or
|
16
|
+
# from the surrounding describe's class. The surrounding class may
|
17
|
+
# subclass Minitest::Spec manually in order to easily share code:
|
18
|
+
#
|
19
|
+
# class MySpec < Minitest::Spec
|
20
|
+
# # ... shared code ...
|
21
|
+
# end
|
22
|
+
#
|
23
|
+
# class TestStuff < MySpec
|
24
|
+
# it "does stuff" do
|
25
|
+
# # shared code available here
|
26
|
+
# end
|
27
|
+
# describe "inner stuff" do
|
28
|
+
# it "still does stuff" do
|
29
|
+
# # ...and here
|
30
|
+
# end
|
31
|
+
# end
|
32
|
+
# end
|
33
|
+
#
|
34
|
+
# For more information on getting started with writing specs, see:
|
35
|
+
#
|
36
|
+
# http://www.rubyinside.com/a-minitestspec-tutorial-elegant-spec-style-testing-that-comes-with-ruby-5354.html
|
37
|
+
#
|
38
|
+
# For some suggestions on how to improve your specs, try:
|
39
|
+
#
|
40
|
+
# https://betterspecs.org
|
41
|
+
#
|
42
|
+
# but do note that several items there are debatable or specific to
|
43
|
+
# rspec.
|
44
|
+
#
|
45
|
+
# For more information about expectations, see Minitest::Expectations.
|
46
|
+
#
|
47
|
+
# source://minitest//lib/minitest/spec.rb#82
|
48
|
+
def describe(desc, *additional_desc, &block); end
|
49
|
+
end
|
50
|
+
|
7
51
|
# :include: README.rdoc
|
8
52
|
#
|
9
53
|
# source://minitest//lib/minitest/parallel.rb#1
|
@@ -252,6 +296,11 @@ module Minitest::Assertions
|
|
252
296
|
# source://minitest//lib/minitest/assertions.rb#291
|
253
297
|
def assert_match(matcher, obj, msg = T.unsafe(nil)); end
|
254
298
|
|
299
|
+
# Assert that the mock verifies correctly.
|
300
|
+
#
|
301
|
+
# source://minitest//lib/minitest/mock.rb#248
|
302
|
+
def assert_mock(mock); end
|
303
|
+
|
255
304
|
# Fails unless +obj+ is nil
|
256
305
|
#
|
257
306
|
# source://minitest//lib/minitest/assertions.rb#303
|
@@ -675,6 +724,248 @@ class Minitest::CompositeReporter < ::Minitest::AbstractReporter
|
|
675
724
|
def start; end
|
676
725
|
end
|
677
726
|
|
727
|
+
# source://minitest//lib/minitest/spec.rb#41
|
728
|
+
class Minitest::Expectation < ::Struct
|
729
|
+
def ctx; end
|
730
|
+
def ctx=(_); end
|
731
|
+
|
732
|
+
# source://minitest//lib/minitest/spec.rb#25
|
733
|
+
def must_be(*args, **_arg1); end
|
734
|
+
|
735
|
+
# source://minitest//lib/minitest/spec.rb#25
|
736
|
+
def must_be_close_to(*args, **_arg1); end
|
737
|
+
|
738
|
+
# source://minitest//lib/minitest/spec.rb#25
|
739
|
+
def must_be_empty(*args, **_arg1); end
|
740
|
+
|
741
|
+
# source://minitest//lib/minitest/spec.rb#25
|
742
|
+
def must_be_instance_of(*args, **_arg1); end
|
743
|
+
|
744
|
+
# source://minitest//lib/minitest/spec.rb#25
|
745
|
+
def must_be_kind_of(*args, **_arg1); end
|
746
|
+
|
747
|
+
# source://minitest//lib/minitest/spec.rb#25
|
748
|
+
def must_be_nil(*args, **_arg1); end
|
749
|
+
|
750
|
+
# source://minitest//lib/minitest/spec.rb#25
|
751
|
+
def must_be_same_as(*args, **_arg1); end
|
752
|
+
|
753
|
+
# source://minitest//lib/minitest/spec.rb#25
|
754
|
+
def must_be_silent(*args, **_arg1); end
|
755
|
+
|
756
|
+
# source://minitest//lib/minitest/spec.rb#25
|
757
|
+
def must_be_within_delta(*args, **_arg1); end
|
758
|
+
|
759
|
+
# source://minitest//lib/minitest/spec.rb#25
|
760
|
+
def must_be_within_epsilon(*args, **_arg1); end
|
761
|
+
|
762
|
+
# source://minitest//lib/minitest/spec.rb#25
|
763
|
+
def must_equal(*args, **_arg1); end
|
764
|
+
|
765
|
+
# source://minitest//lib/minitest/spec.rb#25
|
766
|
+
def must_include(*args, **_arg1); end
|
767
|
+
|
768
|
+
# source://minitest//lib/minitest/spec.rb#25
|
769
|
+
def must_match(*args, **_arg1); end
|
770
|
+
|
771
|
+
# source://minitest//lib/minitest/spec.rb#25
|
772
|
+
def must_output(*args, **_arg1); end
|
773
|
+
|
774
|
+
# source://minitest//lib/minitest/spec.rb#25
|
775
|
+
def must_pattern_match(*args, **_arg1); end
|
776
|
+
|
777
|
+
# source://minitest//lib/minitest/spec.rb#25
|
778
|
+
def must_raise(*args, **_arg1); end
|
779
|
+
|
780
|
+
# source://minitest//lib/minitest/spec.rb#25
|
781
|
+
def must_respond_to(*args, **_arg1); end
|
782
|
+
|
783
|
+
# source://minitest//lib/minitest/spec.rb#25
|
784
|
+
def must_throw(*args, **_arg1); end
|
785
|
+
|
786
|
+
# source://minitest//lib/minitest/spec.rb#25
|
787
|
+
def path_must_exist(*args, **_arg1); end
|
788
|
+
|
789
|
+
# source://minitest//lib/minitest/spec.rb#25
|
790
|
+
def path_wont_exist(*args, **_arg1); end
|
791
|
+
|
792
|
+
def target; end
|
793
|
+
def target=(_); end
|
794
|
+
|
795
|
+
# source://minitest//lib/minitest/spec.rb#25
|
796
|
+
def wont_be(*args, **_arg1); end
|
797
|
+
|
798
|
+
# source://minitest//lib/minitest/spec.rb#25
|
799
|
+
def wont_be_close_to(*args, **_arg1); end
|
800
|
+
|
801
|
+
# source://minitest//lib/minitest/spec.rb#25
|
802
|
+
def wont_be_empty(*args, **_arg1); end
|
803
|
+
|
804
|
+
# source://minitest//lib/minitest/spec.rb#25
|
805
|
+
def wont_be_instance_of(*args, **_arg1); end
|
806
|
+
|
807
|
+
# source://minitest//lib/minitest/spec.rb#25
|
808
|
+
def wont_be_kind_of(*args, **_arg1); end
|
809
|
+
|
810
|
+
# source://minitest//lib/minitest/spec.rb#25
|
811
|
+
def wont_be_nil(*args, **_arg1); end
|
812
|
+
|
813
|
+
# source://minitest//lib/minitest/spec.rb#25
|
814
|
+
def wont_be_same_as(*args, **_arg1); end
|
815
|
+
|
816
|
+
# source://minitest//lib/minitest/spec.rb#25
|
817
|
+
def wont_be_within_delta(*args, **_arg1); end
|
818
|
+
|
819
|
+
# source://minitest//lib/minitest/spec.rb#25
|
820
|
+
def wont_be_within_epsilon(*args, **_arg1); end
|
821
|
+
|
822
|
+
# source://minitest//lib/minitest/spec.rb#25
|
823
|
+
def wont_equal(*args, **_arg1); end
|
824
|
+
|
825
|
+
# source://minitest//lib/minitest/spec.rb#25
|
826
|
+
def wont_include(*args, **_arg1); end
|
827
|
+
|
828
|
+
# source://minitest//lib/minitest/spec.rb#25
|
829
|
+
def wont_match(*args, **_arg1); end
|
830
|
+
|
831
|
+
# source://minitest//lib/minitest/spec.rb#25
|
832
|
+
def wont_pattern_match(*args, **_arg1); end
|
833
|
+
|
834
|
+
# source://minitest//lib/minitest/spec.rb#25
|
835
|
+
def wont_respond_to(*args, **_arg1); end
|
836
|
+
|
837
|
+
class << self
|
838
|
+
def [](*_arg0); end
|
839
|
+
def inspect; end
|
840
|
+
def keyword_init?; end
|
841
|
+
def members; end
|
842
|
+
def new(*_arg0); end
|
843
|
+
end
|
844
|
+
end
|
845
|
+
|
846
|
+
# It's where you hide your "assertions".
|
847
|
+
#
|
848
|
+
# Please note, because of the way that expectations are implemented,
|
849
|
+
# all expectations (eg must_equal) are dependent upon a thread local
|
850
|
+
# variable +:current_spec+. If your specs rely on mixing threads into
|
851
|
+
# the specs themselves, you're better off using assertions or the new
|
852
|
+
# _(value) wrapper. For example:
|
853
|
+
#
|
854
|
+
# it "should still work in threads" do
|
855
|
+
# my_threaded_thingy do
|
856
|
+
# (1+1).must_equal 2 # bad
|
857
|
+
# assert_equal 2, 1+1 # good
|
858
|
+
# _(1 + 1).must_equal 2 # good
|
859
|
+
# value(1 + 1).must_equal 2 # good, also #expect
|
860
|
+
# _ { 1 + "1" }.must_raise TypeError # good
|
861
|
+
# end
|
862
|
+
# end
|
863
|
+
#
|
864
|
+
# source://minitest//lib/minitest/expectations.rb#20
|
865
|
+
module Minitest::Expectations
|
866
|
+
# source://minitest//lib/minitest/spec.rb#15
|
867
|
+
def must_be(*args, **_arg1); end
|
868
|
+
|
869
|
+
# source://minitest//lib/minitest/spec.rb#15
|
870
|
+
def must_be_close_to(*args, **_arg1); end
|
871
|
+
|
872
|
+
# source://minitest//lib/minitest/spec.rb#15
|
873
|
+
def must_be_empty(*args, **_arg1); end
|
874
|
+
|
875
|
+
# source://minitest//lib/minitest/spec.rb#15
|
876
|
+
def must_be_instance_of(*args, **_arg1); end
|
877
|
+
|
878
|
+
# source://minitest//lib/minitest/spec.rb#15
|
879
|
+
def must_be_kind_of(*args, **_arg1); end
|
880
|
+
|
881
|
+
# source://minitest//lib/minitest/spec.rb#15
|
882
|
+
def must_be_nil(*args, **_arg1); end
|
883
|
+
|
884
|
+
# source://minitest//lib/minitest/spec.rb#15
|
885
|
+
def must_be_same_as(*args, **_arg1); end
|
886
|
+
|
887
|
+
# source://minitest//lib/minitest/spec.rb#15
|
888
|
+
def must_be_silent(*args, **_arg1); end
|
889
|
+
|
890
|
+
# source://minitest//lib/minitest/spec.rb#15
|
891
|
+
def must_be_within_delta(*args, **_arg1); end
|
892
|
+
|
893
|
+
# source://minitest//lib/minitest/spec.rb#15
|
894
|
+
def must_be_within_epsilon(*args, **_arg1); end
|
895
|
+
|
896
|
+
# source://minitest//lib/minitest/spec.rb#15
|
897
|
+
def must_equal(*args, **_arg1); end
|
898
|
+
|
899
|
+
# source://minitest//lib/minitest/spec.rb#15
|
900
|
+
def must_include(*args, **_arg1); end
|
901
|
+
|
902
|
+
# source://minitest//lib/minitest/spec.rb#15
|
903
|
+
def must_match(*args, **_arg1); end
|
904
|
+
|
905
|
+
# source://minitest//lib/minitest/spec.rb#15
|
906
|
+
def must_output(*args, **_arg1); end
|
907
|
+
|
908
|
+
# source://minitest//lib/minitest/spec.rb#15
|
909
|
+
def must_pattern_match(*args, **_arg1); end
|
910
|
+
|
911
|
+
# source://minitest//lib/minitest/spec.rb#15
|
912
|
+
def must_raise(*args, **_arg1); end
|
913
|
+
|
914
|
+
# source://minitest//lib/minitest/spec.rb#15
|
915
|
+
def must_respond_to(*args, **_arg1); end
|
916
|
+
|
917
|
+
# source://minitest//lib/minitest/spec.rb#15
|
918
|
+
def must_throw(*args, **_arg1); end
|
919
|
+
|
920
|
+
# source://minitest//lib/minitest/spec.rb#15
|
921
|
+
def path_must_exist(*args, **_arg1); end
|
922
|
+
|
923
|
+
# source://minitest//lib/minitest/spec.rb#15
|
924
|
+
def path_wont_exist(*args, **_arg1); end
|
925
|
+
|
926
|
+
# source://minitest//lib/minitest/spec.rb#15
|
927
|
+
def wont_be(*args, **_arg1); end
|
928
|
+
|
929
|
+
# source://minitest//lib/minitest/spec.rb#15
|
930
|
+
def wont_be_close_to(*args, **_arg1); end
|
931
|
+
|
932
|
+
# source://minitest//lib/minitest/spec.rb#15
|
933
|
+
def wont_be_empty(*args, **_arg1); end
|
934
|
+
|
935
|
+
# source://minitest//lib/minitest/spec.rb#15
|
936
|
+
def wont_be_instance_of(*args, **_arg1); end
|
937
|
+
|
938
|
+
# source://minitest//lib/minitest/spec.rb#15
|
939
|
+
def wont_be_kind_of(*args, **_arg1); end
|
940
|
+
|
941
|
+
# source://minitest//lib/minitest/spec.rb#15
|
942
|
+
def wont_be_nil(*args, **_arg1); end
|
943
|
+
|
944
|
+
# source://minitest//lib/minitest/spec.rb#15
|
945
|
+
def wont_be_same_as(*args, **_arg1); end
|
946
|
+
|
947
|
+
# source://minitest//lib/minitest/spec.rb#15
|
948
|
+
def wont_be_within_delta(*args, **_arg1); end
|
949
|
+
|
950
|
+
# source://minitest//lib/minitest/spec.rb#15
|
951
|
+
def wont_be_within_epsilon(*args, **_arg1); end
|
952
|
+
|
953
|
+
# source://minitest//lib/minitest/spec.rb#15
|
954
|
+
def wont_equal(*args, **_arg1); end
|
955
|
+
|
956
|
+
# source://minitest//lib/minitest/spec.rb#15
|
957
|
+
def wont_include(*args, **_arg1); end
|
958
|
+
|
959
|
+
# source://minitest//lib/minitest/spec.rb#15
|
960
|
+
def wont_match(*args, **_arg1); end
|
961
|
+
|
962
|
+
# source://minitest//lib/minitest/spec.rb#15
|
963
|
+
def wont_pattern_match(*args, **_arg1); end
|
964
|
+
|
965
|
+
# source://minitest//lib/minitest/spec.rb#15
|
966
|
+
def wont_respond_to(*args, **_arg1); end
|
967
|
+
end
|
968
|
+
|
678
969
|
# Provides a simple set of guards that you can use in your tests
|
679
970
|
# to skip execution if it is not applicable. These methods are
|
680
971
|
# mixed into Test as both instance and class methods so you
|
@@ -734,6 +1025,106 @@ module Minitest::Guard
|
|
734
1025
|
def windows?(platform = T.unsafe(nil)); end
|
735
1026
|
end
|
736
1027
|
|
1028
|
+
# A simple and clean mock object framework.
|
1029
|
+
#
|
1030
|
+
# All mock objects are an instance of Mock
|
1031
|
+
#
|
1032
|
+
# source://minitest//lib/minitest/mock.rb#10
|
1033
|
+
class Minitest::Mock
|
1034
|
+
# @return [Mock] a new instance of Mock
|
1035
|
+
#
|
1036
|
+
# source://minitest//lib/minitest/mock.rb#48
|
1037
|
+
def initialize(delegator = T.unsafe(nil)); end
|
1038
|
+
|
1039
|
+
# source://minitest//lib/minitest/mock.rb#31
|
1040
|
+
def ===(*args, **kwargs, &b); end
|
1041
|
+
|
1042
|
+
# source://minitest//lib/minitest/mock.rb#120
|
1043
|
+
def __call(name, data); end
|
1044
|
+
|
1045
|
+
def __respond_to?(*_arg0); end
|
1046
|
+
|
1047
|
+
# source://minitest//lib/minitest/mock.rb#31
|
1048
|
+
def class(*args, **kwargs, &b); end
|
1049
|
+
|
1050
|
+
# Expect that method +name+ is called, optionally with +args+ (and
|
1051
|
+
# +kwargs+ or a +blk+), and returns +retval+.
|
1052
|
+
#
|
1053
|
+
# @mock.expect(:meaning_of_life, 42)
|
1054
|
+
# @mock.meaning_of_life # => 42
|
1055
|
+
#
|
1056
|
+
# @mock.expect(:do_something_with, true, [some_obj, true])
|
1057
|
+
# @mock.do_something_with(some_obj, true) # => true
|
1058
|
+
#
|
1059
|
+
# @mock.expect(:do_something_else, true) do |a1, a2|
|
1060
|
+
# a1 == "buggs" && a2 == :bunny
|
1061
|
+
# end
|
1062
|
+
#
|
1063
|
+
# +args+ is compared to the expected args using case equality (ie, the
|
1064
|
+
# '===' operator), allowing for less specific expectations.
|
1065
|
+
#
|
1066
|
+
# @mock.expect(:uses_any_string, true, [String])
|
1067
|
+
# @mock.uses_any_string("foo") # => true
|
1068
|
+
# @mock.verify # => true
|
1069
|
+
#
|
1070
|
+
# @mock.expect(:uses_one_string, true, ["foo"])
|
1071
|
+
# @mock.uses_one_string("bar") # => raises MockExpectationError
|
1072
|
+
#
|
1073
|
+
# If a method will be called multiple times, specify a new expect for each one.
|
1074
|
+
# They will be used in the order you define them.
|
1075
|
+
#
|
1076
|
+
# @mock.expect(:ordinal_increment, 'first')
|
1077
|
+
# @mock.expect(:ordinal_increment, 'second')
|
1078
|
+
#
|
1079
|
+
# @mock.ordinal_increment # => 'first'
|
1080
|
+
# @mock.ordinal_increment # => 'second'
|
1081
|
+
# @mock.ordinal_increment # => raises MockExpectationError "No more expects available for :ordinal_increment"
|
1082
|
+
#
|
1083
|
+
# source://minitest//lib/minitest/mock.rb#91
|
1084
|
+
def expect(name, retval, args = T.unsafe(nil), **kwargs, &blk); end
|
1085
|
+
|
1086
|
+
# source://minitest//lib/minitest/mock.rb#31
|
1087
|
+
def inspect(*args, **kwargs, &b); end
|
1088
|
+
|
1089
|
+
# source://minitest//lib/minitest/mock.rb#31
|
1090
|
+
def instance_eval(*args, **kwargs, &b); end
|
1091
|
+
|
1092
|
+
# source://minitest//lib/minitest/mock.rb#31
|
1093
|
+
def instance_variables(*args, **kwargs, &b); end
|
1094
|
+
|
1095
|
+
# source://minitest//lib/minitest/mock.rb#150
|
1096
|
+
def method_missing(sym, *args, **kwargs, &block); end
|
1097
|
+
|
1098
|
+
# source://minitest//lib/minitest/mock.rb#31
|
1099
|
+
def object_id(*args, **kwargs, &b); end
|
1100
|
+
|
1101
|
+
# source://minitest//lib/minitest/mock.rb#31
|
1102
|
+
def public_send(*args, **kwargs, &b); end
|
1103
|
+
|
1104
|
+
# @return [Boolean]
|
1105
|
+
#
|
1106
|
+
# source://minitest//lib/minitest/mock.rb#236
|
1107
|
+
def respond_to?(sym, include_private = T.unsafe(nil)); end
|
1108
|
+
|
1109
|
+
# source://minitest//lib/minitest/mock.rb#31
|
1110
|
+
def send(*args, **kwargs, &b); end
|
1111
|
+
|
1112
|
+
# source://minitest//lib/minitest/mock.rb#31
|
1113
|
+
def to_s(*args, **kwargs, &b); end
|
1114
|
+
|
1115
|
+
# Verify that all methods were called as expected. Raises
|
1116
|
+
# +MockExpectationError+ if the mock object was not called as
|
1117
|
+
# expected.
|
1118
|
+
#
|
1119
|
+
# source://minitest//lib/minitest/mock.rb#140
|
1120
|
+
def verify; end
|
1121
|
+
|
1122
|
+
private
|
1123
|
+
|
1124
|
+
# source://minitest//lib/minitest/mock.rb#31
|
1125
|
+
def respond_to_missing?(*args, **kwargs, &b); end
|
1126
|
+
end
|
1127
|
+
|
737
1128
|
# source://minitest//lib/minitest/parallel.rb#2
|
738
1129
|
module Minitest::Parallel; end
|
739
1130
|
|
@@ -1075,6 +1466,239 @@ class Minitest::Skip < ::Minitest::Assertion
|
|
1075
1466
|
def result_label; end
|
1076
1467
|
end
|
1077
1468
|
|
1469
|
+
# Minitest::Spec -- The faster, better, less-magical spec framework!
|
1470
|
+
#
|
1471
|
+
# For a list of expectations, see Minitest::Expectations.
|
1472
|
+
#
|
1473
|
+
# source://minitest//lib/minitest/spec.rb#106
|
1474
|
+
class Minitest::Spec < ::Minitest::Test
|
1475
|
+
include ::Minitest::Spec::DSL::InstanceMethods
|
1476
|
+
extend ::Minitest::Spec::DSL
|
1477
|
+
|
1478
|
+
# @return [Spec] a new instance of Spec
|
1479
|
+
#
|
1480
|
+
# source://minitest//lib/minitest/spec.rb#112
|
1481
|
+
def initialize(name); end
|
1482
|
+
|
1483
|
+
class << self
|
1484
|
+
# source://minitest//lib/minitest/spec.rb#108
|
1485
|
+
def current; end
|
1486
|
+
end
|
1487
|
+
end
|
1488
|
+
|
1489
|
+
# Oh look! A Minitest::Spec::DSL module! Eat your heart out DHH.
|
1490
|
+
#
|
1491
|
+
# source://minitest//lib/minitest/spec.rb#120
|
1492
|
+
module Minitest::Spec::DSL
|
1493
|
+
# Define an 'after' action. Inherits the way normal methods should.
|
1494
|
+
#
|
1495
|
+
# NOTE: +type+ is ignored and is only there to make porting easier.
|
1496
|
+
#
|
1497
|
+
# Equivalent to Minitest::Test#teardown.
|
1498
|
+
#
|
1499
|
+
# source://minitest//lib/minitest/spec.rb#205
|
1500
|
+
def after(_type = T.unsafe(nil), &block); end
|
1501
|
+
|
1502
|
+
# Define a 'before' action. Inherits the way normal methods should.
|
1503
|
+
#
|
1504
|
+
# NOTE: +type+ is ignored and is only there to make porting easier.
|
1505
|
+
#
|
1506
|
+
# Equivalent to Minitest::Test#setup.
|
1507
|
+
#
|
1508
|
+
# source://minitest//lib/minitest/spec.rb#191
|
1509
|
+
def before(_type = T.unsafe(nil), &block); end
|
1510
|
+
|
1511
|
+
# source://minitest//lib/minitest/spec.rb#174
|
1512
|
+
def children; end
|
1513
|
+
|
1514
|
+
# source://minitest//lib/minitest/spec.rb#270
|
1515
|
+
def create(name, desc); end
|
1516
|
+
|
1517
|
+
# source://minitest//lib/minitest/spec.rb#291
|
1518
|
+
def desc; end
|
1519
|
+
|
1520
|
+
# source://minitest//lib/minitest/spec.rb#170
|
1521
|
+
def describe_stack; end
|
1522
|
+
|
1523
|
+
# Define an expectation with name +desc+. Name gets morphed to a
|
1524
|
+
# proper test method name. For some freakish reason, people who
|
1525
|
+
# write specs don't like class inheritance, so this goes way out of
|
1526
|
+
# its way to make sure that expectations aren't inherited.
|
1527
|
+
#
|
1528
|
+
# This is also aliased to #specify and doesn't require a +desc+ arg.
|
1529
|
+
#
|
1530
|
+
# Hint: If you _do_ want inheritance, use minitest/test. You can mix
|
1531
|
+
# and match between assertions and expectations as much as you want.
|
1532
|
+
#
|
1533
|
+
# source://minitest//lib/minitest/spec.rb#223
|
1534
|
+
def it(desc = T.unsafe(nil), &block); end
|
1535
|
+
|
1536
|
+
# Essentially, define an accessor for +name+ with +block+.
|
1537
|
+
#
|
1538
|
+
# Why use let instead of def? I honestly don't know.
|
1539
|
+
#
|
1540
|
+
# @raise [ArgumentError]
|
1541
|
+
#
|
1542
|
+
# source://minitest//lib/minitest/spec.rb#247
|
1543
|
+
def let(name, &block); end
|
1544
|
+
|
1545
|
+
# source://minitest//lib/minitest/spec.rb#283
|
1546
|
+
def name; end
|
1547
|
+
|
1548
|
+
# source://minitest//lib/minitest/spec.rb#178
|
1549
|
+
def nuke_test_methods!; end
|
1550
|
+
|
1551
|
+
# Register a new type of spec that matches the spec's description.
|
1552
|
+
# This method can take either a Regexp and a spec class or a spec
|
1553
|
+
# class and a block that takes the description and returns true if
|
1554
|
+
# it matches.
|
1555
|
+
#
|
1556
|
+
# Eg:
|
1557
|
+
#
|
1558
|
+
# register_spec_type(/Controller$/, Minitest::Spec::Rails)
|
1559
|
+
#
|
1560
|
+
# or:
|
1561
|
+
#
|
1562
|
+
# register_spec_type(Minitest::Spec::RailsModel) do |desc|
|
1563
|
+
# desc.superclass == ActiveRecord::Base
|
1564
|
+
# end
|
1565
|
+
#
|
1566
|
+
# source://minitest//lib/minitest/spec.rb#146
|
1567
|
+
def register_spec_type(*args, &block); end
|
1568
|
+
|
1569
|
+
# Figure out the spec class to use based on a spec's description. Eg:
|
1570
|
+
#
|
1571
|
+
# spec_type("BlahController") # => Minitest::Spec::Rails
|
1572
|
+
#
|
1573
|
+
# source://minitest//lib/minitest/spec.rb#160
|
1574
|
+
def spec_type(desc, *additional); end
|
1575
|
+
|
1576
|
+
# Define an expectation with name +desc+. Name gets morphed to a
|
1577
|
+
# proper test method name. For some freakish reason, people who
|
1578
|
+
# write specs don't like class inheritance, so this goes way out of
|
1579
|
+
# its way to make sure that expectations aren't inherited.
|
1580
|
+
#
|
1581
|
+
# This is also aliased to #specify and doesn't require a +desc+ arg.
|
1582
|
+
#
|
1583
|
+
# Hint: If you _do_ want inheritance, use minitest/test. You can mix
|
1584
|
+
# and match between assertions and expectations as much as you want.
|
1585
|
+
#
|
1586
|
+
# source://minitest//lib/minitest/spec.rb#223
|
1587
|
+
def specify(desc = T.unsafe(nil), &block); end
|
1588
|
+
|
1589
|
+
# Another lazy man's accessor generator. Made even more lazy by
|
1590
|
+
# setting the name for you to +subject+.
|
1591
|
+
#
|
1592
|
+
# source://minitest//lib/minitest/spec.rb#266
|
1593
|
+
def subject(&block); end
|
1594
|
+
|
1595
|
+
# source://minitest//lib/minitest/spec.rb#287
|
1596
|
+
def to_s; end
|
1597
|
+
|
1598
|
+
class << self
|
1599
|
+
# source://minitest//lib/minitest/spec.rb#335
|
1600
|
+
def extended(obj); end
|
1601
|
+
end
|
1602
|
+
end
|
1603
|
+
|
1604
|
+
# Rdoc... why are you so dumb?
|
1605
|
+
#
|
1606
|
+
# source://minitest//lib/minitest/spec.rb#297
|
1607
|
+
module Minitest::Spec::DSL::InstanceMethods
|
1608
|
+
# Takes a value or a block and returns a value monad that has
|
1609
|
+
# all of Expectations methods available to it.
|
1610
|
+
#
|
1611
|
+
# _(1 + 1).must_equal 2
|
1612
|
+
#
|
1613
|
+
# And for blocks:
|
1614
|
+
#
|
1615
|
+
# _ { 1 + "1" }.must_raise TypeError
|
1616
|
+
#
|
1617
|
+
# This method of expectation-based testing is preferable to
|
1618
|
+
# straight-expectation methods (on Object) because it stores its
|
1619
|
+
# test context, bypassing our hacky use of thread-local variables.
|
1620
|
+
#
|
1621
|
+
# NOTE: At some point, the methods on Object will be deprecated
|
1622
|
+
# and then removed.
|
1623
|
+
#
|
1624
|
+
# It is also aliased to #value and #expect for your aesthetic
|
1625
|
+
# pleasure:
|
1626
|
+
#
|
1627
|
+
# _(1 + 1).must_equal 2
|
1628
|
+
# value(1 + 1).must_equal 2
|
1629
|
+
# expect(1 + 1).must_equal 2
|
1630
|
+
#
|
1631
|
+
# source://minitest//lib/minitest/spec.rb#322
|
1632
|
+
def _(value = T.unsafe(nil), &block); end
|
1633
|
+
|
1634
|
+
# source://minitest//lib/minitest/spec.rb#329
|
1635
|
+
def before_setup; end
|
1636
|
+
|
1637
|
+
# Takes a value or a block and returns a value monad that has
|
1638
|
+
# all of Expectations methods available to it.
|
1639
|
+
#
|
1640
|
+
# _(1 + 1).must_equal 2
|
1641
|
+
#
|
1642
|
+
# And for blocks:
|
1643
|
+
#
|
1644
|
+
# _ { 1 + "1" }.must_raise TypeError
|
1645
|
+
#
|
1646
|
+
# This method of expectation-based testing is preferable to
|
1647
|
+
# straight-expectation methods (on Object) because it stores its
|
1648
|
+
# test context, bypassing our hacky use of thread-local variables.
|
1649
|
+
#
|
1650
|
+
# NOTE: At some point, the methods on Object will be deprecated
|
1651
|
+
# and then removed.
|
1652
|
+
#
|
1653
|
+
# It is also aliased to #value and #expect for your aesthetic
|
1654
|
+
# pleasure:
|
1655
|
+
#
|
1656
|
+
# _(1 + 1).must_equal 2
|
1657
|
+
# value(1 + 1).must_equal 2
|
1658
|
+
# expect(1 + 1).must_equal 2
|
1659
|
+
#
|
1660
|
+
# source://minitest//lib/minitest/spec.rb#322
|
1661
|
+
def expect(value = T.unsafe(nil), &block); end
|
1662
|
+
|
1663
|
+
# Takes a value or a block and returns a value monad that has
|
1664
|
+
# all of Expectations methods available to it.
|
1665
|
+
#
|
1666
|
+
# _(1 + 1).must_equal 2
|
1667
|
+
#
|
1668
|
+
# And for blocks:
|
1669
|
+
#
|
1670
|
+
# _ { 1 + "1" }.must_raise TypeError
|
1671
|
+
#
|
1672
|
+
# This method of expectation-based testing is preferable to
|
1673
|
+
# straight-expectation methods (on Object) because it stores its
|
1674
|
+
# test context, bypassing our hacky use of thread-local variables.
|
1675
|
+
#
|
1676
|
+
# NOTE: At some point, the methods on Object will be deprecated
|
1677
|
+
# and then removed.
|
1678
|
+
#
|
1679
|
+
# It is also aliased to #value and #expect for your aesthetic
|
1680
|
+
# pleasure:
|
1681
|
+
#
|
1682
|
+
# _(1 + 1).must_equal 2
|
1683
|
+
# value(1 + 1).must_equal 2
|
1684
|
+
# expect(1 + 1).must_equal 2
|
1685
|
+
#
|
1686
|
+
# source://minitest//lib/minitest/spec.rb#322
|
1687
|
+
def value(value = T.unsafe(nil), &block); end
|
1688
|
+
end
|
1689
|
+
|
1690
|
+
# Contains pairs of matchers and Spec classes to be used to
|
1691
|
+
# calculate the superclass of a top-level describe. This allows for
|
1692
|
+
# automatically customizable spec types.
|
1693
|
+
#
|
1694
|
+
# See: register_spec_type and spec_type
|
1695
|
+
#
|
1696
|
+
# source://minitest//lib/minitest/spec.rb#128
|
1697
|
+
Minitest::Spec::DSL::TYPES = T.let(T.unsafe(nil), Array)
|
1698
|
+
|
1699
|
+
# source://minitest//lib/minitest/spec.rb#342
|
1700
|
+
Minitest::Spec::TYPES = T.let(T.unsafe(nil), Array)
|
1701
|
+
|
1078
1702
|
# A reporter that gathers statistics about a test run. Does not do
|
1079
1703
|
# any IO because meant to be used as a parent class for a reporter
|
1080
1704
|
# that does.
|
@@ -1489,3 +2113,41 @@ Minitest::Unit::VERSION = T.let(T.unsafe(nil), String)
|
|
1489
2113
|
|
1490
2114
|
# source://minitest//lib/minitest.rb#12
|
1491
2115
|
Minitest::VERSION = T.let(T.unsafe(nil), String)
|
2116
|
+
|
2117
|
+
# source://minitest//lib/minitest/mock.rb#1
|
2118
|
+
class MockExpectationError < ::StandardError; end
|
2119
|
+
|
2120
|
+
# source://minitest//lib/minitest/spec.rb#3
|
2121
|
+
class Module
|
2122
|
+
# source://minitest//lib/minitest/spec.rb#4
|
2123
|
+
def infect_an_assertion(meth, new_name, dont_flip = T.unsafe(nil)); end
|
2124
|
+
end
|
2125
|
+
|
2126
|
+
# source://minitest//lib/minitest/spec.rb#347
|
2127
|
+
class Object < ::BasicObject
|
2128
|
+
include ::Kernel
|
2129
|
+
include ::PP::ObjectMixin
|
2130
|
+
include ::Minitest::Expectations
|
2131
|
+
|
2132
|
+
# Add a temporary stubbed method replacing +name+ for the duration
|
2133
|
+
# of the +block+. If +val_or_callable+ responds to #call, then it
|
2134
|
+
# returns the result of calling it, otherwise returns the value
|
2135
|
+
# as-is. If stubbed method yields a block, +block_args+ will be
|
2136
|
+
# passed along. Cleans up the stub at the end of the +block+. The
|
2137
|
+
# method +name+ must exist before stubbing.
|
2138
|
+
#
|
2139
|
+
# def test_stale_eh
|
2140
|
+
# obj_under_test = Something.new
|
2141
|
+
# refute obj_under_test.stale?
|
2142
|
+
#
|
2143
|
+
# Time.stub :now, Time.at(0) do
|
2144
|
+
# assert obj_under_test.stale?
|
2145
|
+
# end
|
2146
|
+
# end
|
2147
|
+
# --
|
2148
|
+
# NOTE: keyword args in callables are NOT checked for correctness
|
2149
|
+
# against the existing method. Too many edge cases to be worth it.
|
2150
|
+
#
|
2151
|
+
# source://minitest//lib/minitest/mock.rb#278
|
2152
|
+
def stub(name, val_or_callable, *block_args, **block_kwargs, &block); end
|
2153
|
+
end
|