packwerk 2.1.1 → 2.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (189) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +29 -20
  3. data/.github/workflows/cla.yml +22 -0
  4. data/.rubocop.yml +48 -19
  5. data/Gemfile +7 -2
  6. data/Gemfile.lock +204 -177
  7. data/README.md +7 -2
  8. data/RESOLVING_VIOLATIONS.md +81 -0
  9. data/Rakefile +1 -1
  10. data/USAGE.md +14 -5
  11. data/bin/m +1 -1
  12. data/bin/rake +1 -1
  13. data/bin/rubocop +1 -1
  14. data/bin/srb +1 -1
  15. data/bin/tapioca +1 -1
  16. data/gemfiles/Gemfile-rails-6-0 +1 -1
  17. data/gemfiles/Gemfile-rails-6-1 +22 -0
  18. data/lib/packwerk/application_load_paths.rb +12 -18
  19. data/lib/packwerk/application_validator.rb +7 -6
  20. data/lib/packwerk/association_inspector.rb +17 -15
  21. data/lib/packwerk/cache.rb +36 -29
  22. data/lib/packwerk/cli.rb +14 -8
  23. data/lib/packwerk/const_node_inspector.rb +8 -7
  24. data/lib/packwerk/constant_name_inspector.rb +2 -2
  25. data/lib/packwerk/deprecated_references.rb +34 -19
  26. data/lib/packwerk/file_processor.rb +25 -23
  27. data/lib/packwerk/files_for_processing.rb +33 -35
  28. data/lib/packwerk/formatters/offenses_formatter.rb +3 -3
  29. data/lib/packwerk/formatters/progress_formatter.rb +2 -2
  30. data/lib/packwerk/node.rb +1 -294
  31. data/lib/packwerk/node_helpers.rb +335 -0
  32. data/lib/packwerk/node_processor.rb +6 -5
  33. data/lib/packwerk/node_processor_factory.rb +3 -3
  34. data/lib/packwerk/node_visitor.rb +1 -1
  35. data/lib/packwerk/offense_collection.rb +6 -3
  36. data/lib/packwerk/offenses_formatter.rb +2 -2
  37. data/lib/packwerk/package.rb +3 -0
  38. data/lib/packwerk/package_set.rb +3 -1
  39. data/lib/packwerk/parse_run.rb +15 -13
  40. data/lib/packwerk/parsed_constant_definitions.rb +23 -20
  41. data/lib/packwerk/parsers/erb.rb +3 -3
  42. data/lib/packwerk/parsers/parser_interface.rb +2 -0
  43. data/lib/packwerk/reference_checking/checkers/checker.rb +16 -3
  44. data/lib/packwerk/reference_checking/checkers/dependency_checker.rb +16 -0
  45. data/lib/packwerk/reference_checking/checkers/privacy_checker.rb +18 -0
  46. data/lib/packwerk/reference_checking/reference_checker.rb +4 -4
  47. data/lib/packwerk/reference_extractor.rb +51 -54
  48. data/lib/packwerk/reference_offense.rb +3 -27
  49. data/lib/packwerk/run_context.rb +9 -7
  50. data/lib/packwerk/spring_command.rb +1 -1
  51. data/lib/packwerk/version.rb +1 -1
  52. data/lib/packwerk.rb +1 -0
  53. data/packwerk.gemspec +4 -11
  54. data/sorbet/rbi/gems/actioncable@7.0.3.1.rbi +2754 -0
  55. data/sorbet/rbi/gems/actionmailbox@7.0.3.1.rbi +1496 -0
  56. data/sorbet/rbi/gems/actionmailer@7.0.3.1.rbi +2362 -0
  57. data/sorbet/rbi/gems/actionpack@7.0.3.1.rbi +19397 -0
  58. data/sorbet/rbi/gems/actiontext@7.0.3.1.rbi +1569 -0
  59. data/sorbet/rbi/gems/actionview@7.0.3.1.rbi +14907 -0
  60. data/sorbet/rbi/gems/activejob@7.0.3.1.rbi +2553 -0
  61. data/sorbet/rbi/gems/activemodel@7.0.3.1.rbi +5999 -0
  62. data/sorbet/rbi/gems/activerecord@7.0.3.1.rbi +37832 -0
  63. data/sorbet/rbi/gems/activestorage@7.0.3.1.rbi +2321 -0
  64. data/sorbet/rbi/gems/activesupport@7.0.3.1.rbi +18818 -0
  65. data/sorbet/rbi/gems/concurrent-ruby@1.1.10.rbi +11722 -0
  66. data/sorbet/rbi/gems/constant_resolver@0.2.0.rbi +90 -0
  67. data/sorbet/rbi/gems/diff-lcs@1.5.0.rbi +1079 -0
  68. data/sorbet/rbi/gems/digest@3.1.0.rbi +189 -0
  69. data/sorbet/rbi/gems/erubi@1.11.0.rbi +140 -0
  70. data/sorbet/rbi/gems/globalid@1.0.0.rbi +572 -0
  71. data/sorbet/rbi/gems/i18n@1.12.0.rbi +2296 -0
  72. data/sorbet/rbi/gems/json@2.6.2.rbi +1548 -0
  73. data/sorbet/rbi/gems/language_server-protocol@3.16.0.3.rbi +8 -0
  74. data/sorbet/rbi/gems/loofah@2.18.0.rbi +877 -0
  75. data/sorbet/rbi/gems/m@1.6.0.rbi +257 -0
  76. data/sorbet/rbi/gems/marcel@1.0.2.rbi +220 -0
  77. data/sorbet/rbi/gems/mini_mime@1.1.2.rbi +170 -0
  78. data/sorbet/rbi/gems/mini_portile2@2.8.0.rbi +8 -0
  79. data/sorbet/rbi/gems/minitest-focus@1.3.1.rbi +104 -0
  80. data/sorbet/rbi/gems/minitest@5.16.2.rbi +2136 -0
  81. data/sorbet/rbi/gems/mocha@1.14.0.rbi +4177 -0
  82. data/sorbet/rbi/gems/net-imap@0.2.3.rbi +2147 -0
  83. data/sorbet/rbi/gems/net-pop@0.1.1.rbi +926 -0
  84. data/sorbet/rbi/gems/net-protocol@0.1.3.rbi +11 -0
  85. data/sorbet/rbi/gems/net-smtp@0.3.1.rbi +1108 -0
  86. data/sorbet/rbi/gems/netrc@0.11.0.rbi +153 -0
  87. data/sorbet/rbi/gems/nio4r@2.5.8.rbi +292 -0
  88. data/sorbet/rbi/gems/nokogiri@1.13.8.rbi +6478 -0
  89. data/sorbet/rbi/gems/parallel@1.22.1.rbi +277 -0
  90. data/sorbet/rbi/gems/parser@3.1.2.1.rbi +9029 -0
  91. data/sorbet/rbi/gems/prettier_print@0.1.0.rbi +8 -0
  92. data/sorbet/rbi/gems/pry@0.14.1.rbi +8 -0
  93. data/sorbet/rbi/gems/racc@1.6.0.rbi +152 -0
  94. data/sorbet/rbi/gems/rack-test@2.0.2.rbi +953 -0
  95. data/sorbet/rbi/gems/rack@2.2.4.rbi +5636 -0
  96. data/sorbet/rbi/gems/rails-html-sanitizer@1.4.3.rbi +688 -0
  97. data/sorbet/rbi/gems/rails@7.0.3.1.rbi +8 -0
  98. data/sorbet/rbi/gems/railties@7.0.3.1.rbi +3507 -0
  99. data/sorbet/rbi/gems/rainbow@3.1.1.rbi +392 -0
  100. data/sorbet/rbi/gems/rake@13.0.6.rbi +2924 -0
  101. data/sorbet/rbi/gems/rbi@0.0.15.rbi +3007 -0
  102. data/sorbet/rbi/gems/regexp_parser@2.5.0.rbi +3383 -0
  103. data/sorbet/rbi/gems/rexml@3.2.5.rbi +4714 -0
  104. data/sorbet/rbi/gems/rubocop-ast@1.21.0.rbi +6961 -0
  105. data/sorbet/rbi/gems/rubocop-performance@1.14.3.rbi +2986 -0
  106. data/sorbet/rbi/gems/{rubocop-shopify@2.0.1.rbi → rubocop-shopify@2.9.0.rbi} +4 -4
  107. data/sorbet/rbi/gems/rubocop-sorbet@0.6.11.rbi +992 -0
  108. data/sorbet/rbi/gems/rubocop@1.34.1.rbi +51820 -0
  109. data/sorbet/rbi/gems/ruby-lsp@0.2.1.rbi +11 -0
  110. data/sorbet/rbi/gems/smart_properties@1.17.0.rbi +474 -0
  111. data/sorbet/rbi/gems/spoom@1.1.11.rbi +2181 -0
  112. data/sorbet/rbi/gems/spring@4.0.0.rbi +411 -0
  113. data/sorbet/rbi/gems/strscan@3.0.4.rbi +8 -0
  114. data/sorbet/rbi/gems/syntax_tree@3.3.0.rbi +8 -0
  115. data/sorbet/rbi/gems/tapioca@0.9.2.rbi +3181 -0
  116. data/sorbet/rbi/gems/thor@1.2.1.rbi +3956 -0
  117. data/sorbet/rbi/gems/timeout@0.3.0.rbi +142 -0
  118. data/sorbet/rbi/gems/tzinfo@2.0.5.rbi +5896 -0
  119. data/sorbet/rbi/gems/unicode-display_width@2.2.0.rbi +48 -0
  120. data/sorbet/rbi/gems/unparser@0.6.5.rbi +4529 -0
  121. data/sorbet/rbi/gems/webrick@1.7.0.rbi +2582 -0
  122. data/sorbet/rbi/gems/websocket-driver@0.7.5.rbi +993 -0
  123. data/sorbet/rbi/gems/yard-sorbet@0.6.1.rbi +388 -0
  124. data/sorbet/rbi/gems/yard@0.9.28.rbi +18242 -0
  125. data/sorbet/rbi/gems/zeitwerk@2.6.0.rbi +867 -0
  126. data/sorbet/rbi/shims/psych.rbi +5 -0
  127. data/sorbet/tapioca/require.rb +2 -3
  128. metadata +88 -143
  129. data/.github/probots.yml +0 -2
  130. data/library.yml +0 -6
  131. data/service.yml +0 -1
  132. data/sorbet/rbi/gems/actioncable@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi +0 -860
  133. data/sorbet/rbi/gems/actionmailbox@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi +0 -568
  134. data/sorbet/rbi/gems/actionmailer@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi +0 -587
  135. data/sorbet/rbi/gems/actionpack@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi +0 -5314
  136. data/sorbet/rbi/gems/actiontext@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi +0 -699
  137. data/sorbet/rbi/gems/actionview@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi +0 -2515
  138. data/sorbet/rbi/gems/activejob@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi +0 -624
  139. data/sorbet/rbi/gems/activemodel@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi +0 -1248
  140. data/sorbet/rbi/gems/activerecord@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi +0 -8363
  141. data/sorbet/rbi/gems/activestorage@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi +0 -876
  142. data/sorbet/rbi/gems/activesupport@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi +0 -3987
  143. data/sorbet/rbi/gems/colorize@0.8.1.rbi +0 -40
  144. data/sorbet/rbi/gems/commander@4.5.2.rbi +0 -8
  145. data/sorbet/rbi/gems/concurrent-ruby@1.1.8.rbi +0 -1969
  146. data/sorbet/rbi/gems/constant_resolver@0.1.5.rbi +0 -26
  147. data/sorbet/rbi/gems/erubi@1.10.0.rbi +0 -41
  148. data/sorbet/rbi/gems/globalid@0.4.2.rbi +0 -178
  149. data/sorbet/rbi/gems/highline@2.0.3.rbi +0 -8
  150. data/sorbet/rbi/gems/i18n@1.8.10.rbi +0 -600
  151. data/sorbet/rbi/gems/loofah@2.9.0.rbi +0 -274
  152. data/sorbet/rbi/gems/m@1.5.1.rbi +0 -108
  153. data/sorbet/rbi/gems/marcel@1.0.0.rbi +0 -70
  154. data/sorbet/rbi/gems/mini_mime@1.0.3.rbi +0 -71
  155. data/sorbet/rbi/gems/minitest-focus@1.2.1.rbi +0 -8
  156. data/sorbet/rbi/gems/minitest@5.14.4.rbi +0 -544
  157. data/sorbet/rbi/gems/mocha@1.12.0.rbi +0 -953
  158. data/sorbet/rbi/gems/nio4r@2.5.7.rbi +0 -90
  159. data/sorbet/rbi/gems/nokogiri@1.11.2.rbi +0 -1647
  160. data/sorbet/rbi/gems/parallel@1.20.1.rbi +0 -117
  161. data/sorbet/rbi/gems/parlour@6.0.0.rbi +0 -1272
  162. data/sorbet/rbi/gems/parser@3.0.0.0.rbi +0 -1745
  163. data/sorbet/rbi/gems/pry@0.14.0.rbi +0 -8
  164. data/sorbet/rbi/gems/psych@3.3.2.rbi +0 -24
  165. data/sorbet/rbi/gems/racc@1.5.2.rbi +0 -57
  166. data/sorbet/rbi/gems/rack-test@1.1.0.rbi +0 -335
  167. data/sorbet/rbi/gems/rack@2.2.3.rbi +0 -1718
  168. data/sorbet/rbi/gems/rails-html-sanitizer@1.3.0.rbi +0 -213
  169. data/sorbet/rbi/gems/rails@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi +0 -8
  170. data/sorbet/rbi/gems/railties@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi +0 -880
  171. data/sorbet/rbi/gems/rainbow@3.0.0.rbi +0 -155
  172. data/sorbet/rbi/gems/rake@13.0.3.rbi +0 -837
  173. data/sorbet/rbi/gems/regexp_parser@2.1.1.rbi +0 -8
  174. data/sorbet/rbi/gems/rexml@3.2.4.rbi +0 -8
  175. data/sorbet/rbi/gems/rubocop-ast@1.4.1.rbi +0 -8
  176. data/sorbet/rbi/gems/rubocop-performance@1.10.2.rbi +0 -8
  177. data/sorbet/rbi/gems/rubocop-sorbet@0.6.1.rbi +0 -8
  178. data/sorbet/rbi/gems/rubocop@1.12.0.rbi +0 -8
  179. data/sorbet/rbi/gems/smart_properties@1.15.0.rbi +0 -168
  180. data/sorbet/rbi/gems/spoom@1.1.0.rbi +0 -1061
  181. data/sorbet/rbi/gems/spring@2.1.1.rbi +0 -160
  182. data/sorbet/rbi/gems/sprockets-rails@3.2.2.rbi +0 -451
  183. data/sorbet/rbi/gems/sprockets@4.0.2.rbi +0 -1133
  184. data/sorbet/rbi/gems/tapioca@0.4.19.rbi +0 -603
  185. data/sorbet/rbi/gems/thor@1.1.0.rbi +0 -893
  186. data/sorbet/rbi/gems/tzinfo@2.0.4.rbi +0 -566
  187. data/sorbet/rbi/gems/unicode-display_width@2.0.0.rbi +0 -8
  188. data/sorbet/rbi/gems/websocket-driver@0.7.3.rbi +0 -438
  189. data/sorbet/rbi/gems/zeitwerk@2.4.2.rbi +0 -177
@@ -0,0 +1,4177 @@
1
+ # typed: true
2
+
3
+ # DO NOT EDIT MANUALLY
4
+ # This is an autogenerated file for types exported from the `mocha` gem.
5
+ # Please instead update this file by running `bin/tapioca gem mocha`.
6
+
7
+ # source://yard-0.9.28/lib/yard.rb:62
8
+ ::RUBY19 = T.let(T.unsafe(nil), TrueClass)
9
+
10
+ # source://mocha-1.14.0/lib/mocha/inspect.rb:45
11
+ class Array
12
+ include ::Enumerable
13
+ include ::Mocha::Inspect::ArrayMethods
14
+ end
15
+
16
+ class Class < ::Module
17
+ include ::Mocha::ClassMethods
18
+ end
19
+
20
+ # source://mocha-1.14.0/lib/mocha/inspect.rb:57
21
+ class Date
22
+ include ::Comparable
23
+ include ::Mocha::Inspect::DateMethods
24
+ end
25
+
26
+ # source://mocha-1.14.0/lib/mocha/inspect.rb:49
27
+ class Hash
28
+ include ::Enumerable
29
+ include ::Mocha::Inspect::HashMethods
30
+ end
31
+
32
+ class Minitest::Test < ::Minitest::Runnable
33
+ include ::Mocha::ParameterMatchers
34
+ include ::Mocha::Hooks
35
+ include ::Mocha::API
36
+ include ::Mocha::Integration::MiniTest::Adapter
37
+ end
38
+
39
+ # source://mocha-1.14.0/lib/mocha/version.rb:1
40
+ module Mocha
41
+ class << self
42
+ # @private
43
+ #
44
+ # source://mocha-1.14.0/lib/mocha/configuration.rb:22
45
+ def configuration; end
46
+
47
+ # Allows setting of configuration options. See {Configuration} for the available options.
48
+ #
49
+ # Typically the configuration is set globally in a +test_helper.rb+ or +spec_helper.rb+ file.
50
+ #
51
+ # @example Setting multiple configuration options
52
+ # Mocha.configure do |c|
53
+ # c.stubbing_method_unnecessarily = :prevent
54
+ # c.stubbing_method_on_non_mock_object = :warn
55
+ # c.stubbing_method_on_nil = :allow
56
+ # end
57
+ # @see Configuration
58
+ # @yieldparam configuration [Configuration] the configuration for modification
59
+ #
60
+ # source://mocha-1.14.0/lib/mocha/configuration.rb:17
61
+ def configure; end
62
+ end
63
+ end
64
+
65
+ # Methods added to +Test::Unit::TestCase+, +MiniTest::Unit::TestCase+ or equivalent.
66
+ # The mock creation methods are {#mock}, {#stub} and {#stub_everything}, all of which return a #{Mock}
67
+ # which can be further modified by {Mock#responds_like} and {Mock#responds_like_instance_of} methods,
68
+ # both of which return a {Mock}, too, and can therefore, be chained to the original creation methods.
69
+ #
70
+ # {Mock#responds_like} and {Mock#responds_like_instance_of} force the mock to indicate what it is
71
+ # supposed to be mocking, thus making it a safer verifying mock. They check that the underlying +responder+
72
+ # will actually respond to the methods being stubbed, throwing a +NoMethodError+ upon invocation otherwise.
73
+ #
74
+ # @example Verifying mock using {Mock#responds_like_instance_of}
75
+ # class Sheep
76
+ # def initialize
77
+ # raise "some awkward code we don't want to call"
78
+ # end
79
+ # def chew(grass); end
80
+ # end
81
+ #
82
+ # sheep = mock('sheep').responds_like_instance_of(Sheep)
83
+ # sheep.expects(:chew)
84
+ # sheep.expects(:foo)
85
+ # sheep.respond_to?(:chew) # => true
86
+ # sheep.respond_to?(:foo) # => false
87
+ # sheep.chew
88
+ # sheep.foo # => raises NoMethodError exception
89
+ #
90
+ # source://mocha-1.14.0/lib/mocha/api.rb:33
91
+ module Mocha::API
92
+ include ::Mocha::ParameterMatchers
93
+ include ::Mocha::Hooks
94
+
95
+ # Builds a new mock object
96
+ #
97
+ # @example Using expected_methods_vs_return_values Hash to setup expectations.
98
+ # def test_motor_starts_and_stops
99
+ # motor = mock('motor', :start => true, :stop => true)
100
+ # assert motor.start
101
+ # assert motor.stop
102
+ # # an error will be raised unless both Motor#start and Motor#stop have been called
103
+ # end
104
+ # @overload mock
105
+ # @overload mock
106
+ # @overload mock
107
+ # @return [Mock] a new mock object
108
+ #
109
+ # source://mocha-1.14.0/lib/mocha/api.rb:69
110
+ def mock(*arguments); end
111
+
112
+ # Builds a new sequence which can be used to constrain the order in which expectations can occur.
113
+ #
114
+ # Specify that an expected invocation must occur within a named {Sequence} by using {Expectation#in_sequence}.
115
+ #
116
+ # @example Ensure methods on egg are invoked in correct order.
117
+ # breakfast = sequence('breakfast')
118
+ #
119
+ # egg = mock('egg') do
120
+ # expects(:crack).in_sequence(breakfast)
121
+ # expects(:fry).in_sequence(breakfast)
122
+ # expects(:eat).in_sequence(breakfast)
123
+ # end
124
+ # @return [Sequence] a new sequence
125
+ # @see Expectation#in_sequence
126
+ #
127
+ # source://mocha-1.14.0/lib/mocha/api.rb:207
128
+ def sequence(name); end
129
+
130
+ # Builds a new state machine which can be used to constrain the order in which expectations can occur.
131
+ #
132
+ # Specify the initial state of the state machine by using {StateMachine#starts_as}.
133
+ #
134
+ # Specify that an expected invocation should change the state of the state machine by using {Expectation#then}.
135
+ #
136
+ # Specify that an expected invocation should be constrained to occur within a particular +state+ by using {Expectation#when}.
137
+ #
138
+ # A test can contain multiple state machines.
139
+ #
140
+ # @example Constrain expected invocations to occur in particular states.
141
+ # power = states('power').starts_as('off')
142
+ #
143
+ # radio = mock('radio') do
144
+ # expects(:switch_on).then(power.is('on'))
145
+ # expects(:select_channel).with('BBC Radio 4').when(power.is('on'))
146
+ # expects(:adjust_volume).with(+5).when(power.is('on'))
147
+ # expects(:select_channel).with('BBC World Service').when(power.is('on'))
148
+ # expects(:adjust_volume).with(-5).when(power.is('on'))
149
+ # expects(:switch_off).then(power.is('off'))
150
+ # end
151
+ # @return [StateMachine] a new state machine
152
+ # @see Expectation#then
153
+ # @see Expectation#when
154
+ # @see StateMachine
155
+ #
156
+ # source://mocha-1.14.0/lib/mocha/api.rb:237
157
+ def states(name); end
158
+
159
+ # Builds a new mock object
160
+ #
161
+ #
162
+ # @example Using stubbed_methods_vs_return_values Hash to setup stubbed methods.
163
+ # def test_motor_starts_and_stops
164
+ # motor = stub('motor', :start => true, :stop => true)
165
+ # assert motor.start
166
+ # assert motor.stop
167
+ # # an error will not be raised even if either Motor#start or Motor#stop has not been called
168
+ # end
169
+ # @overload stub
170
+ # @overload stub
171
+ # @overload stub
172
+ # @return [Mock] a new mock object
173
+ #
174
+ # source://mocha-1.14.0/lib/mocha/api.rb:115
175
+ def stub(*arguments); end
176
+
177
+ # Builds a mock object that accepts calls to any method. By default it will return +nil+ for any method call.
178
+ #
179
+ #
180
+ # @example Ignore invocations of irrelevant methods.
181
+ # def test_motor_stops
182
+ # motor = stub_everything('motor', :stop => true)
183
+ # assert_nil motor.irrelevant_method_1 # => no error raised
184
+ # assert_nil motor.irrelevant_method_2 # => no error raised
185
+ # assert motor.stop
186
+ # end
187
+ # @overload stub_everything
188
+ # @overload stub_everything
189
+ # @overload stub_everything
190
+ # @return [Mock] a new mock object
191
+ #
192
+ # source://mocha-1.14.0/lib/mocha/api.rb:163
193
+ def stub_everything(*arguments); end
194
+
195
+ class << self
196
+ # @private
197
+ # @private
198
+ #
199
+ # source://mocha-1.14.0/lib/mocha/api.rb:44
200
+ def extended(mod); end
201
+
202
+ # @private
203
+ # @private
204
+ #
205
+ # source://mocha-1.14.0/lib/mocha/api.rb:38
206
+ def included(_mod); end
207
+ end
208
+ end
209
+
210
+ # source://mocha-1.14.0/lib/mocha/any_instance_method.rb:5
211
+ class Mocha::AnyInstanceMethod < ::Mocha::StubbedMethod
212
+ private
213
+
214
+ # source://mocha-1.14.0/lib/mocha/any_instance_method.rb:12
215
+ def method_body(method); end
216
+
217
+ # source://mocha-1.14.0/lib/mocha/any_instance_method.rb:8
218
+ def mock_owner; end
219
+
220
+ # source://mocha-1.14.0/lib/mocha/any_instance_method.rb:20
221
+ def original_method_owner; end
222
+
223
+ # source://mocha-1.14.0/lib/mocha/any_instance_method.rb:16
224
+ def stubbee_method(method_name); end
225
+ end
226
+
227
+ # source://mocha-1.14.0/lib/mocha/receivers.rb:19
228
+ class Mocha::AnyInstanceReceiver
229
+ # @return [AnyInstanceReceiver] a new instance of AnyInstanceReceiver
230
+ #
231
+ # source://mocha-1.14.0/lib/mocha/receivers.rb:20
232
+ def initialize(klass); end
233
+
234
+ # source://mocha-1.14.0/lib/mocha/receivers.rb:24
235
+ def mocks; end
236
+ end
237
+
238
+ # source://mocha-1.14.0/lib/mocha/argument_iterator.rb:2
239
+ class Mocha::ArgumentIterator
240
+ # @return [ArgumentIterator] a new instance of ArgumentIterator
241
+ #
242
+ # source://mocha-1.14.0/lib/mocha/argument_iterator.rb:3
243
+ def initialize(argument); end
244
+
245
+ # source://mocha-1.14.0/lib/mocha/argument_iterator.rb:7
246
+ def each; end
247
+ end
248
+
249
+ # source://mocha-1.14.0/lib/mocha/backtrace_filter.rb:2
250
+ class Mocha::BacktraceFilter
251
+ # @return [BacktraceFilter] a new instance of BacktraceFilter
252
+ #
253
+ # source://mocha-1.14.0/lib/mocha/backtrace_filter.rb:5
254
+ def initialize(lib_directory = T.unsafe(nil)); end
255
+
256
+ # source://mocha-1.14.0/lib/mocha/backtrace_filter.rb:9
257
+ def filtered(backtrace); end
258
+ end
259
+
260
+ # source://mocha-1.14.0/lib/mocha/backtrace_filter.rb:3
261
+ Mocha::BacktraceFilter::LIB_DIRECTORY = T.let(T.unsafe(nil), String)
262
+
263
+ # source://mocha-1.14.0/lib/mocha/block_matcher.rb:2
264
+ module Mocha::BlockMatchers; end
265
+
266
+ # source://mocha-1.14.0/lib/mocha/block_matcher.rb:11
267
+ class Mocha::BlockMatchers::BlockGiven
268
+ # @return [Boolean]
269
+ #
270
+ # source://mocha-1.14.0/lib/mocha/block_matcher.rb:12
271
+ def match?(actual_block); end
272
+
273
+ # source://mocha-1.14.0/lib/mocha/block_matcher.rb:16
274
+ def mocha_inspect; end
275
+ end
276
+
277
+ # source://mocha-1.14.0/lib/mocha/block_matcher.rb:21
278
+ class Mocha::BlockMatchers::NoBlockGiven
279
+ # @return [Boolean]
280
+ #
281
+ # source://mocha-1.14.0/lib/mocha/block_matcher.rb:22
282
+ def match?(actual_block); end
283
+
284
+ # source://mocha-1.14.0/lib/mocha/block_matcher.rb:26
285
+ def mocha_inspect; end
286
+ end
287
+
288
+ # source://mocha-1.14.0/lib/mocha/block_matcher.rb:3
289
+ class Mocha::BlockMatchers::OptionalBlock
290
+ # @return [Boolean]
291
+ #
292
+ # source://mocha-1.14.0/lib/mocha/block_matcher.rb:4
293
+ def match?(_actual_block); end
294
+
295
+ # source://mocha-1.14.0/lib/mocha/block_matcher.rb:8
296
+ def mocha_inspect; end
297
+ end
298
+
299
+ # source://mocha-1.14.0/lib/mocha/cardinality.rb:2
300
+ class Mocha::Cardinality
301
+ # @return [Cardinality] a new instance of Cardinality
302
+ #
303
+ # source://mocha-1.14.0/lib/mocha/cardinality.rb:5
304
+ def initialize(required = T.unsafe(nil), maximum = T.unsafe(nil)); end
305
+
306
+ # source://mocha-1.14.0/lib/mocha/cardinality.rb:29
307
+ def <<(invocation); end
308
+
309
+ # source://mocha-1.14.0/lib/mocha/cardinality.rb:79
310
+ def actual_invocations; end
311
+
312
+ # @return [Boolean]
313
+ #
314
+ # source://mocha-1.14.0/lib/mocha/cardinality.rb:49
315
+ def allowed_any_number_of_times?; end
316
+
317
+ # source://mocha-1.14.0/lib/mocha/cardinality.rb:58
318
+ def anticipated_times; end
319
+
320
+ # source://mocha-1.14.0/lib/mocha/cardinality.rb:14
321
+ def at_least(count); end
322
+
323
+ # source://mocha-1.14.0/lib/mocha/cardinality.rb:18
324
+ def at_most(count); end
325
+
326
+ # source://mocha-1.14.0/lib/mocha/cardinality.rb:10
327
+ def exactly(count); end
328
+
329
+ # @return [Boolean]
330
+ #
331
+ # source://mocha-1.14.0/lib/mocha/cardinality.rb:33
332
+ def invocations_allowed?; end
333
+
334
+ # source://mocha-1.14.0/lib/mocha/cardinality.rb:75
335
+ def invoked_times; end
336
+
337
+ # @return [Boolean]
338
+ #
339
+ # source://mocha-1.14.0/lib/mocha/cardinality.rb:41
340
+ def needs_verifying?; end
341
+
342
+ # @return [Boolean]
343
+ #
344
+ # source://mocha-1.14.0/lib/mocha/cardinality.rb:37
345
+ def satisfied?; end
346
+
347
+ # source://mocha-1.14.0/lib/mocha/cardinality.rb:22
348
+ def times(range_or_count); end
349
+
350
+ # @return [Boolean]
351
+ #
352
+ # source://mocha-1.14.0/lib/mocha/cardinality.rb:53
353
+ def used?; end
354
+
355
+ # @return [Boolean]
356
+ #
357
+ # source://mocha-1.14.0/lib/mocha/cardinality.rb:45
358
+ def verified?; end
359
+
360
+ protected
361
+
362
+ # source://mocha-1.14.0/lib/mocha/cardinality.rb:87
363
+ def count(number); end
364
+
365
+ # @return [Boolean]
366
+ #
367
+ # source://mocha-1.14.0/lib/mocha/cardinality.rb:102
368
+ def infinite?(number); end
369
+
370
+ # Returns the value of attribute maximum.
371
+ #
372
+ # source://mocha-1.14.0/lib/mocha/cardinality.rb:85
373
+ def maximum; end
374
+
375
+ # Returns the value of attribute required.
376
+ #
377
+ # source://mocha-1.14.0/lib/mocha/cardinality.rb:85
378
+ def required; end
379
+
380
+ # source://mocha-1.14.0/lib/mocha/cardinality.rb:96
381
+ def update(required, maximum); end
382
+ end
383
+
384
+ # source://mocha-1.14.0/lib/mocha/cardinality.rb:3
385
+ Mocha::Cardinality::INFINITY = T.let(T.unsafe(nil), Float)
386
+
387
+ # source://mocha-1.14.0/lib/mocha/central.rb:2
388
+ class Mocha::Central
389
+ # @return [Central] a new instance of Central
390
+ #
391
+ # source://mocha-1.14.0/lib/mocha/central.rb:20
392
+ def initialize; end
393
+
394
+ # source://mocha-1.14.0/lib/mocha/central.rb:24
395
+ def stub(method); end
396
+
397
+ # Returns the value of attribute stubba_methods.
398
+ #
399
+ # source://mocha-1.14.0/lib/mocha/central.rb:18
400
+ def stubba_methods; end
401
+
402
+ # Sets the attribute stubba_methods
403
+ #
404
+ # @param value the value to set the attribute stubba_methods to.
405
+ #
406
+ # source://mocha-1.14.0/lib/mocha/central.rb:18
407
+ def stubba_methods=(_arg0); end
408
+
409
+ # source://mocha-1.14.0/lib/mocha/central.rb:30
410
+ def unstub(method); end
411
+
412
+ # source://mocha-1.14.0/lib/mocha/central.rb:36
413
+ def unstub_all; end
414
+ end
415
+
416
+ # source://mocha-1.14.0/lib/mocha/central.rb:3
417
+ class Mocha::Central::Null < ::Mocha::Central
418
+ # @return [Null] a new instance of Null
419
+ #
420
+ # source://mocha-1.14.0/lib/mocha/central.rb:4
421
+ def initialize(&block); end
422
+
423
+ # source://mocha-1.14.0/lib/mocha/central.rb:9
424
+ def stub(*_arg0); end
425
+
426
+ # source://mocha-1.14.0/lib/mocha/central.rb:13
427
+ def unstub(*_arg0); end
428
+ end
429
+
430
+ # source://mocha-1.14.0/lib/mocha/change_state_side_effect.rb:2
431
+ class Mocha::ChangeStateSideEffect
432
+ # @return [ChangeStateSideEffect] a new instance of ChangeStateSideEffect
433
+ #
434
+ # source://mocha-1.14.0/lib/mocha/change_state_side_effect.rb:3
435
+ def initialize(state); end
436
+
437
+ # source://mocha-1.14.0/lib/mocha/change_state_side_effect.rb:11
438
+ def mocha_inspect; end
439
+
440
+ # source://mocha-1.14.0/lib/mocha/change_state_side_effect.rb:7
441
+ def perform; end
442
+ end
443
+
444
+ # Methods added to all classes to allow mocking and stubbing on real (i.e. non-mock) objects.
445
+ #
446
+ # source://mocha-1.14.0/lib/mocha/class_methods.rb:6
447
+ module Mocha::ClassMethods
448
+ # @private
449
+ #
450
+ # source://mocha-1.14.0/lib/mocha/class_methods.rb:54
451
+ def __method_exists__?(method, include_public_methods = T.unsafe(nil)); end
452
+
453
+ # @private
454
+ #
455
+ # source://mocha-1.14.0/lib/mocha/class_methods.rb:54
456
+ def __method_visibility__(method, include_public_methods = T.unsafe(nil)); end
457
+
458
+ # @example Return false to invocation of +Product#save+ for any instance of +Product+.
459
+ # Product.any_instance.stubs(:save).returns(false)
460
+ # product_1 = Product.new
461
+ # assert_equal false, product_1.save
462
+ # product_2 = Product.new
463
+ # assert_equal false, product_2.save
464
+ # @raise [StubbingError] if attempting to stub method which is not allowed.
465
+ # @return [Mock] a mock object which will detect calls to any instance of this class.
466
+ #
467
+ # source://mocha-1.14.0/lib/mocha/class_methods.rb:45
468
+ def any_instance; end
469
+ end
470
+
471
+ # @private
472
+ #
473
+ # source://mocha-1.14.0/lib/mocha/class_methods.rb:8
474
+ class Mocha::ClassMethods::AnyInstance
475
+ # @return [AnyInstance] a new instance of AnyInstance
476
+ #
477
+ # source://mocha-1.14.0/lib/mocha/class_methods.rb:9
478
+ def initialize(klass); end
479
+
480
+ # source://mocha-1.14.0/lib/mocha/class_methods.rb:13
481
+ def mocha(instantiate = T.unsafe(nil)); end
482
+
483
+ # @return [Boolean]
484
+ #
485
+ # source://mocha-1.14.0/lib/mocha/class_methods.rb:29
486
+ def respond_to?(method); end
487
+
488
+ # source://mocha-1.14.0/lib/mocha/class_methods.rb:25
489
+ def stubba_class; end
490
+
491
+ # source://mocha-1.14.0/lib/mocha/class_methods.rb:21
492
+ def stubba_method; end
493
+
494
+ # Returns the value of attribute stubba_object.
495
+ #
496
+ # source://mocha-1.14.0/lib/mocha/class_methods.rb:33
497
+ def stubba_object; end
498
+ end
499
+
500
+ # This class provides a number of ways to configure the library.
501
+ #
502
+ # Typically the configuration is set globally in a +test_helper.rb+ or +spec_helper.rb+ file.
503
+ #
504
+ # @example Setting multiple configuration options
505
+ # Mocha.configure do |c|
506
+ # c.stubbing_method_unnecessarily = :prevent
507
+ # c.stubbing_method_on_non_mock_object = :warn
508
+ # c.stubbing_method_on_nil = :allow
509
+ # end
510
+ #
511
+ # source://mocha-1.14.0/lib/mocha/configuration.rb:37
512
+ class Mocha::Configuration
513
+ # @private
514
+ # @return [Configuration] a new instance of Configuration
515
+ #
516
+ # source://mocha-1.14.0/lib/mocha/configuration.rb:53
517
+ def initialize(options = T.unsafe(nil)); end
518
+
519
+ # Display matching invocations alongside expectations on Mocha-related test failure.
520
+ #
521
+ # @example Enable display of matching invocations
522
+ # Mocha.configure do |c|
523
+ # c.display_matching_invocations_on_failure = true
524
+ # end
525
+ #
526
+ # foo = mock('foo')
527
+ # foo.expects(:bar)
528
+ # foo.stubs(:baz).returns('baz').raises(RuntimeError).throws(:tag, 'value')
529
+ #
530
+ # foo.baz(1, 2)
531
+ # assert_raises(RuntimeError) { foo.baz(3, 4) }
532
+ # assert_throws(:tag) { foo.baz(5, 6) }
533
+ #
534
+ # not all expectations were satisfied
535
+ # unsatisfied expectations:
536
+ # - expected exactly once, invoked never: #<Mock:foo>.bar
537
+ # satisfied expectations:
538
+ # - allowed any number of times, invoked 3 times: #<Mock:foo>.baz(any_parameters)
539
+ # - #<Mock:foo>.baz(1, 2) # => "baz"
540
+ # - #<Mock:foo>.baz(3, 4) # => raised RuntimeError
541
+ # - #<Mock:foo>.baz(5, 6) # => threw (:tag, "value")
542
+ # @param value [Boolean] +true+ to enable display of matching invocations; disabled by default.
543
+ #
544
+ # source://mocha-1.14.0/lib/mocha/configuration.rb:242
545
+ def display_matching_invocations_on_failure=(value); end
546
+
547
+ # @private
548
+ # @return [Boolean]
549
+ #
550
+ # source://mocha-1.14.0/lib/mocha/configuration.rb:247
551
+ def display_matching_invocations_on_failure?; end
552
+
553
+ # @private
554
+ #
555
+ # source://mocha-1.14.0/lib/mocha/configuration.rb:63
556
+ def merge(other); end
557
+
558
+ # Reinstate undocumented behaviour from v1.9
559
+ #
560
+ # Previously when {API#mock}, {API#stub}, or {API#stub_everything} were called with the first argument being a symbol, they built an *unnamed* mock object *and* expected or stubbed the method identified by the symbol argument; subsequent arguments were ignored.
561
+ # Now these methods build a *named* mock with the name specified by the symbol argument; *no* methods are expected or stubbed and subsequent arguments *are* taken into account.
562
+ #
563
+ # Previously if {Expectation#yields} or {Expectation#multiple_yields} was called on an expectation, but no block was given when the method was invoked, the instruction to yield was ignored.
564
+ # Now a +LocalJumpError+ is raised.
565
+ #
566
+ # Enabling this configuration option reinstates the previous behaviour, but displays a deprecation warning.
567
+ #
568
+ # @example Reinstate undocumented behaviour for {API#mock}
569
+ # Mocha.configure do |c|
570
+ # c.reinstate_undocumented_behaviour_from_v1_9 = true
571
+ # end
572
+ #
573
+ # foo = mock(:bar)
574
+ # foo.inspect # => #<Mock>
575
+ #
576
+ # not all expectations were satisfied
577
+ # unsatisfied expectations:
578
+ # - expected exactly once, invoked never: #<Mock>.foo
579
+ # @example Reinstate undocumented behaviour for {API#stub}
580
+ # Mocha.configure do |c|
581
+ # c.reinstate_undocumented_behaviour_from_v1_9 = true
582
+ # end
583
+ #
584
+ # foo = stub(:bar)
585
+ # foo.inspect # => #<Mock>
586
+ # foo.bar # => nil
587
+ # @example Reinstate undocumented behaviour for {Expectation#yields}
588
+ # foo = mock('foo')
589
+ # foo.stubs(:my_method).yields(1, 2)
590
+ # foo.my_method # => raises LocalJumpError when no block is supplied
591
+ #
592
+ # Mocha.configure do |c|
593
+ # c.reinstate_undocumented_behaviour_from_v1_9 = true
594
+ # end
595
+ #
596
+ # foo = mock('foo')
597
+ # foo.stubs(:my_method).yields(1, 2)
598
+ # foo.my_method # => does *not* raise LocalJumpError when no block is supplied
599
+ # @param value [Boolean] +true+ to reinstate undocumented behaviour; enabled by default.
600
+ #
601
+ # source://mocha-1.14.0/lib/mocha/configuration.rb:297
602
+ def reinstate_undocumented_behaviour_from_v1_9=(value); end
603
+
604
+ # @private
605
+ # @return [Boolean]
606
+ #
607
+ # source://mocha-1.14.0/lib/mocha/configuration.rb:302
608
+ def reinstate_undocumented_behaviour_from_v1_9?; end
609
+
610
+ # @private
611
+ #
612
+ # source://mocha-1.14.0/lib/mocha/configuration.rb:213
613
+ def stubbing_method_on_nil; end
614
+
615
+ # Configure whether stubbing methods on the +nil+ object is allowed.
616
+ #
617
+ # This is usually done accidentally, but there might be rare cases where it is intended.
618
+ #
619
+ # This option only works for Ruby < v2.2.0. In later versions of Ruby +nil+ is frozen and so a {StubbingError} will be raised if you attempt to stub a method on +nil+.
620
+ #
621
+ # When +value+ is +:allow+, do nothing.
622
+ # When +value+ is +:warn+, display a warning.
623
+ # When +value+ is +:prevent+, raise a {StubbingError}. This is the default.
624
+ #
625
+ # @param value [Symbol] one of +:allow+, +:warn+, +:prevent+.
626
+ #
627
+ # source://mocha-1.14.0/lib/mocha/configuration.rb:208
628
+ def stubbing_method_on_nil=(value); end
629
+
630
+ # @private
631
+ #
632
+ # source://mocha-1.14.0/lib/mocha/configuration.rb:125
633
+ def stubbing_method_on_non_mock_object; end
634
+
635
+ # Configure whether stubbing methods on non-mock objects is allowed.
636
+ #
637
+ # If you like the idea of {http://www.jmock.org/oopsla2004.pdf mocking roles not objects} and {http://www.mockobjects.com/2007/04/test-smell-mocking-concrete-classes.html you don't like stubbing concrete classes}, this is the setting for you. However, while this restriction makes a lot of sense in Java with its {http://java.sun.com/docs/books/tutorial/java/concepts/interface.html explicit interfaces}, it may be moot in Ruby where roles are probably best represented as Modules.
638
+ #
639
+ # When +value+ is +:allow+, do nothing. This is the default.
640
+ # When +value+ is +:warn+, display a warning.
641
+ # When +value+ is +:prevent+, raise a {StubbingError}.
642
+ #
643
+ # @example Preventing stubbing of a method on a non-mock object
644
+ # Mocha.configure do |c|
645
+ # c.stubbing_method_on_non_mock_object = :prevent
646
+ # end
647
+ #
648
+ # class Example
649
+ # def example_method; end
650
+ # end
651
+ #
652
+ # example = Example.new
653
+ # example.stubs(:example_method)
654
+ # # => Mocha::StubbingError: stubbing method on non-mock object:
655
+ # # => #<Example:0x593620>.example_method
656
+ # @param value [Symbol] one of +:allow+, +:warn+, +:prevent+.
657
+ #
658
+ # source://mocha-1.14.0/lib/mocha/configuration.rb:120
659
+ def stubbing_method_on_non_mock_object=(value); end
660
+
661
+ # @private
662
+ #
663
+ # source://mocha-1.14.0/lib/mocha/configuration.rb:92
664
+ def stubbing_method_unnecessarily; end
665
+
666
+ # Configure whether stubbing methods unnecessarily is allowed.
667
+ #
668
+ # This is useful for identifying unused stubs. Unused stubs are often accidentally introduced when code is {http://martinfowler.com/bliki/DefinitionOfRefactoring.html refactored}.
669
+ #
670
+ # When +value+ is +:allow+, do nothing. This is the default.
671
+ # When +value+ is +:warn+, display a warning.
672
+ # When +value+ is +:prevent+, raise a {StubbingError}.
673
+ #
674
+ # @example Preventing unnecessary stubbing of a method
675
+ # Mocha.configure do |c|
676
+ # c.stubbing_method_unnecessarily = :prevent
677
+ # end
678
+ #
679
+ # example = mock('example')
680
+ # example.stubs(:unused_stub)
681
+ # # => Mocha::StubbingError: stubbing method unnecessarily:
682
+ # # => #<Mock:example>.unused_stub(any_parameters)
683
+ # @param value [Symbol] one of +:allow+, +:warn+, +:prevent+.
684
+ #
685
+ # source://mocha-1.14.0/lib/mocha/configuration.rb:87
686
+ def stubbing_method_unnecessarily=(value); end
687
+
688
+ # @private
689
+ #
690
+ # source://mocha-1.14.0/lib/mocha/configuration.rb:158
691
+ def stubbing_non_existent_method; end
692
+
693
+ # Configure whether stubbing of non-existent methods is allowed.
694
+ #
695
+ # This is useful if you want to ensure that methods you're mocking really exist. A common criticism of unit tests with mock objects is that such a test may (incorrectly) pass when an equivalent non-mocking test would (correctly) fail. While you should always have some integration tests, particularly for critical business functionality, this Mocha configuration setting should catch scenarios when mocked methods and real methods have become misaligned.
696
+ #
697
+ # When +value+ is +:allow+, do nothing. This is the default.
698
+ # When +value+ is +:warn+, display a warning.
699
+ # When +value+ is +:prevent+, raise a {StubbingError}.
700
+ #
701
+ # @example Preventing stubbing of a non-existent method
702
+ #
703
+ # Mocha.configure do |c|
704
+ # c.stubbing_non_existent_method = :prevent
705
+ # end
706
+ #
707
+ # class Example
708
+ # end
709
+ #
710
+ # example = Example.new
711
+ # example.stubs(:method_that_doesnt_exist)
712
+ # # => Mocha::StubbingError: stubbing non-existent method:
713
+ # # => #<Example:0x593760>.method_that_doesnt_exist
714
+ # @param value [Symbol] one of +:allow+, +:warn+, +:prevent+.
715
+ #
716
+ # source://mocha-1.14.0/lib/mocha/configuration.rb:153
717
+ def stubbing_non_existent_method=(value); end
718
+
719
+ # @private
720
+ #
721
+ # source://mocha-1.14.0/lib/mocha/configuration.rb:192
722
+ def stubbing_non_public_method; end
723
+
724
+ # Configure whether stubbing of non-public methods is allowed.
725
+ #
726
+ # Many people think that it's good practice only to mock public methods. This is one way to prevent your tests being too tightly coupled to the internal implementation of a class. Such tests tend to be very brittle and not much use when refactoring.
727
+ #
728
+ # When +value+ is +:allow+, do nothing. This is the default.
729
+ # When +value+ is +:warn+, display a warning.
730
+ # When +value+ is +:prevent+, raise a {StubbingError}.
731
+ #
732
+ # @example Preventing stubbing of a non-public method
733
+ # Mocha.configure do |c|
734
+ # c.stubbing_non_public_method = :prevent
735
+ # end
736
+ #
737
+ # class Example
738
+ # def internal_method; end
739
+ # private :internal_method
740
+ # end
741
+ #
742
+ # example = Example.new
743
+ # example.stubs(:internal_method)
744
+ # # => Mocha::StubbingError: stubbing non-public method:
745
+ # # => #<Example:0x593530>.internal_method
746
+ # @param value [Symbol] one of +:allow+, +:warn+, +:prevent+.
747
+ #
748
+ # source://mocha-1.14.0/lib/mocha/configuration.rb:187
749
+ def stubbing_non_public_method=(value); end
750
+
751
+ protected
752
+
753
+ # Returns the value of attribute options.
754
+ #
755
+ # source://mocha-1.14.0/lib/mocha/configuration.rb:49
756
+ def options; end
757
+
758
+ private
759
+
760
+ # @private
761
+ #
762
+ # source://mocha-1.14.0/lib/mocha/configuration.rb:58
763
+ def initialize_copy(other); end
764
+
765
+ class << self
766
+ # Allow the specified +action+.
767
+ #
768
+ # @deprecated If a block is supplied, call {.override} with a +Hash+ containing an entry with the +action+ as the key and +:allow+ as the value. If no block is supplied, call the appropriate +action+ writer method with +value+ set to +:allow+ via {Mocha.configure}. The writer method will be the one of the following corresponding to the +action+:
769
+ # * {#stubbing_method_unnecessarily=}
770
+ # * {#stubbing_method_on_non_mock_object=}
771
+ # * {#stubbing_non_existent_method=}
772
+ # * {#stubbing_non_public_method=}
773
+ # * {#stubbing_method_on_nil=}
774
+ # @param action [Symbol] one of +:stubbing_method_unnecessarily+, +:stubbing_method_on_non_mock_object+, +:stubbing_non_existent_method+, +:stubbing_non_public_method+, +:stubbing_method_on_nil+.
775
+ # @yield optional block during which the configuration change will be changed before being returned to its original value at the end of the block.
776
+ #
777
+ # source://mocha-1.14.0/lib/mocha/configuration.rb:317
778
+ def allow(action, &block); end
779
+
780
+ # @private
781
+ # @return [Boolean]
782
+ #
783
+ # source://mocha-1.14.0/lib/mocha/configuration.rb:327
784
+ def allow?(action); end
785
+
786
+ # @private
787
+ #
788
+ # source://mocha-1.14.0/lib/mocha/configuration.rb:405
789
+ def configuration; end
790
+
791
+ # Temporarily modify {Configuration} options.
792
+ #
793
+ # The supplied +temporary_options+ will override the current configuration for the duration of the supplied block.
794
+ # The configuration will be returned to its original state when the block returns.
795
+ #
796
+ # @example Temporarily allow stubbing of +nil+
797
+ # Mocha::Configuration.override(stubbing_method_on_nil: :allow) do
798
+ # nil.stubs(:foo)
799
+ # end
800
+ # @param temporary_options [Hash] the configuration options to apply for the duration of the block.
801
+ # @yield block during which the configuration change will be in force.
802
+ #
803
+ # source://mocha-1.14.0/lib/mocha/configuration.rb:396
804
+ def override(temporary_options); end
805
+
806
+ # Raise a {StubbingError} if the specified +action+ is attempted.
807
+ #
808
+ # @deprecated If a block is supplied, call {.override} with a +Hash+ containing an entry with the +action+ as the key and +:prevent+ as the value. If no block is supplied, call the appropriate +action+ writer method with +value+ set to +:prevent+ via {Mocha.configure}. The writer method will be the one of the following corresponding to the +action+:
809
+ # * {#stubbing_method_unnecessarily=}
810
+ # * {#stubbing_method_on_non_mock_object=}
811
+ # * {#stubbing_non_existent_method=}
812
+ # * {#stubbing_non_public_method=}
813
+ # * {#stubbing_method_on_nil=}
814
+ # @param action [Symbol] one of +:stubbing_method_unnecessarily+, +:stubbing_method_on_non_mock_object+, +:stubbing_non_existent_method+, +:stubbing_non_public_method+, +:stubbing_method_on_nil+.
815
+ # @yield optional block during which the configuration change will be changed before being returned to its original value at the end of the block.
816
+ #
817
+ # source://mocha-1.14.0/lib/mocha/configuration.rb:365
818
+ def prevent(action, &block); end
819
+
820
+ # @private
821
+ # @return [Boolean]
822
+ #
823
+ # source://mocha-1.14.0/lib/mocha/configuration.rb:375
824
+ def prevent?(action); end
825
+
826
+ # @private
827
+ #
828
+ # source://mocha-1.14.0/lib/mocha/configuration.rb:380
829
+ def reset_configuration; end
830
+
831
+ # Warn if the specified +action+ is attempted.
832
+ #
833
+ # @deprecated If a block is supplied, call {.override} with a +Hash+ containing an entry with the +action+ as the key and +:warn+ as the value. If no block is supplied, call the appropriate +action+ writer method with +value+ set to +:warn+ via {Mocha.configure}. The writer method will be the one of the following corresponding to the +action+:
834
+ # * {#stubbing_method_unnecessarily=}
835
+ # * {#stubbing_method_on_non_mock_object=}
836
+ # * {#stubbing_non_existent_method=}
837
+ # * {#stubbing_non_public_method=}
838
+ # * {#stubbing_method_on_nil=}
839
+ # @param action [Symbol] one of +:stubbing_method_unnecessarily+, +:stubbing_method_on_non_mock_object+, +:stubbing_non_existent_method+, +:stubbing_non_public_method+, +:stubbing_method_on_nil+.
840
+ # @yield optional block during which the configuration change will be changed before being returned to its original value at the end of the block.
841
+ #
842
+ # source://mocha-1.14.0/lib/mocha/configuration.rb:341
843
+ def warn_when(action, &block); end
844
+
845
+ # @private
846
+ # @return [Boolean]
847
+ #
848
+ # source://mocha-1.14.0/lib/mocha/configuration.rb:351
849
+ def warn_when?(action); end
850
+
851
+ private
852
+
853
+ # @private
854
+ #
855
+ # source://mocha-1.14.0/lib/mocha/configuration.rb:412
856
+ def change_config(action, new_value, &block); end
857
+
858
+ # @private
859
+ #
860
+ # source://mocha-1.14.0/lib/mocha/configuration.rb:421
861
+ def temporarily_change_config(action, new_value); end
862
+ end
863
+ end
864
+
865
+ # @private
866
+ #
867
+ # source://mocha-1.14.0/lib/mocha/configuration.rb:39
868
+ Mocha::Configuration::DEFAULTS = T.let(T.unsafe(nil), Hash)
869
+
870
+ # source://mocha-1.14.0/lib/mocha/debug.rb:2
871
+ module Mocha::Debug
872
+ class << self
873
+ # source://mocha-1.14.0/lib/mocha/debug.rb:8
874
+ def puts(message); end
875
+ end
876
+ end
877
+
878
+ # source://mocha-1.14.0/lib/mocha/debug.rb:3
879
+ Mocha::Debug::OPTIONS = T.let(T.unsafe(nil), Hash)
880
+
881
+ # source://mocha-1.14.0/lib/mocha/names.rb:32
882
+ class Mocha::DefaultName
883
+ # @return [DefaultName] a new instance of DefaultName
884
+ #
885
+ # source://mocha-1.14.0/lib/mocha/names.rb:33
886
+ def initialize(mock); end
887
+
888
+ # source://mocha-1.14.0/lib/mocha/names.rb:37
889
+ def mocha_inspect; end
890
+ end
891
+
892
+ # source://mocha-1.14.0/lib/mocha/receivers.rb:36
893
+ class Mocha::DefaultReceiver
894
+ # @return [DefaultReceiver] a new instance of DefaultReceiver
895
+ #
896
+ # source://mocha-1.14.0/lib/mocha/receivers.rb:37
897
+ def initialize(mock); end
898
+
899
+ # source://mocha-1.14.0/lib/mocha/receivers.rb:41
900
+ def mocks; end
901
+ end
902
+
903
+ # source://mocha-1.14.0/lib/mocha/deprecation.rb:4
904
+ class Mocha::Deprecation
905
+ class << self
906
+ # Returns the value of attribute messages.
907
+ #
908
+ # source://mocha-1.14.0/lib/mocha/deprecation.rb:6
909
+ def messages; end
910
+
911
+ # Sets the attribute messages
912
+ #
913
+ # @param value the value to set the attribute messages to.
914
+ #
915
+ # source://mocha-1.14.0/lib/mocha/deprecation.rb:6
916
+ def messages=(_arg0); end
917
+
918
+ # Returns the value of attribute mode.
919
+ #
920
+ # source://mocha-1.14.0/lib/mocha/deprecation.rb:6
921
+ def mode; end
922
+
923
+ # Sets the attribute mode
924
+ #
925
+ # @param value the value to set the attribute mode to.
926
+ #
927
+ # source://mocha-1.14.0/lib/mocha/deprecation.rb:6
928
+ def mode=(_arg0); end
929
+
930
+ # source://mocha-1.14.0/lib/mocha/deprecation.rb:8
931
+ def warning(*messages); end
932
+ end
933
+ end
934
+
935
+ # source://mocha-1.14.0/lib/mocha/detection/mini_test.rb:2
936
+ module Mocha::Detection; end
937
+
938
+ # source://mocha-1.14.0/lib/mocha/detection/mini_test.rb:3
939
+ module Mocha::Detection::MiniTest
940
+ class << self
941
+ # source://mocha-1.14.0/lib/mocha/detection/mini_test.rb:4
942
+ def testcase; end
943
+
944
+ # source://mocha-1.14.0/lib/mocha/detection/mini_test.rb:12
945
+ def version; end
946
+ end
947
+ end
948
+
949
+ # @private
950
+ #
951
+ # source://mocha-1.14.0/lib/mocha/error_with_filtered_backtrace.rb:6
952
+ class Mocha::ErrorWithFilteredBacktrace < ::StandardError
953
+ # @private
954
+ # @return [ErrorWithFilteredBacktrace] a new instance of ErrorWithFilteredBacktrace
955
+ #
956
+ # source://mocha-1.14.0/lib/mocha/error_with_filtered_backtrace.rb:7
957
+ def initialize(message = T.unsafe(nil), backtrace = T.unsafe(nil)); end
958
+ end
959
+
960
+ # source://mocha-1.14.0/lib/mocha/exception_raiser.rb:2
961
+ class Mocha::ExceptionRaiser
962
+ # @return [ExceptionRaiser] a new instance of ExceptionRaiser
963
+ #
964
+ # source://mocha-1.14.0/lib/mocha/exception_raiser.rb:3
965
+ def initialize(exception, message); end
966
+
967
+ # @raise [@exception]
968
+ #
969
+ # source://mocha-1.14.0/lib/mocha/exception_raiser.rb:8
970
+ def evaluate(invocation); end
971
+ end
972
+
973
+ # Methods on expectations returned from {Mock#expects}, {Mock#stubs}, {ObjectMethods#expects} and {ObjectMethods#stubs}.
974
+ #
975
+ # source://mocha-1.14.0/lib/mocha/expectation.rb:17
976
+ class Mocha::Expectation
977
+ # @private
978
+ # @return [Expectation] a new instance of Expectation
979
+ #
980
+ # source://mocha-1.14.0/lib/mocha/expectation.rb:548
981
+ def initialize(mock, expected_method_name, backtrace = T.unsafe(nil)); end
982
+
983
+ # @private
984
+ #
985
+ # source://mocha-1.14.0/lib/mocha/expectation.rb:567
986
+ def add_in_sequence_ordering_constraint(sequence); end
987
+
988
+ # @private
989
+ #
990
+ # source://mocha-1.14.0/lib/mocha/expectation.rb:562
991
+ def add_ordering_constraint(ordering_constraint); end
992
+
993
+ # @private
994
+ #
995
+ # source://mocha-1.14.0/lib/mocha/expectation.rb:572
996
+ def add_side_effect(side_effect); end
997
+
998
+ # Modifies expectation so that the expected method must be called at least a +minimum_number_of_times+.
999
+ #
1000
+ # @example Expected method must be called at least twice.
1001
+ # object = mock()
1002
+ # object.expects(:expected_method).at_least(2)
1003
+ # 3.times { object.expected_method }
1004
+ # # => verify succeeds
1005
+ #
1006
+ # object = mock()
1007
+ # object.expects(:expected_method).at_least(2)
1008
+ # object.expected_method
1009
+ # # => verify fails
1010
+ # @param minimum_number_of_times [Integer] minimum number of expected invocations.
1011
+ # @return [Expectation] the same expectation, thereby allowing invocations of other {Expectation} methods to be chained.
1012
+ #
1013
+ # source://mocha-1.14.0/lib/mocha/expectation.rb:132
1014
+ def at_least(minimum_number_of_times); end
1015
+
1016
+ # Modifies expectation so that the expected method must be called at least once.
1017
+ #
1018
+ # @example Expected method must be called at least once.
1019
+ # object = mock()
1020
+ # object.expects(:expected_method).at_least_once
1021
+ # object.expected_method
1022
+ # # => verify succeeds
1023
+ #
1024
+ # object = mock()
1025
+ # object.expects(:expected_method).at_least_once
1026
+ # # => verify fails
1027
+ # @return [Expectation] the same expectation, thereby allowing invocations of other {Expectation} methods to be chained.
1028
+ #
1029
+ # source://mocha-1.14.0/lib/mocha/expectation.rb:150
1030
+ def at_least_once; end
1031
+
1032
+ # Modifies expectation so that the expected method must be called at most a +maximum_number_of_times+.
1033
+ #
1034
+ # @example Expected method must be called at most twice.
1035
+ # object = mock()
1036
+ # object.expects(:expected_method).at_most(2)
1037
+ # 2.times { object.expected_method }
1038
+ # # => verify succeeds
1039
+ #
1040
+ # object = mock()
1041
+ # object.expects(:expected_method).at_most(2)
1042
+ # 3.times { object.expected_method } # => unexpected invocation
1043
+ # @param maximum_number_of_times [Integer] maximum number of expected invocations.
1044
+ # @return [Expectation] the same expectation, thereby allowing invocations of other {Expectation} methods to be chained.
1045
+ #
1046
+ # source://mocha-1.14.0/lib/mocha/expectation.rb:168
1047
+ def at_most(maximum_number_of_times); end
1048
+
1049
+ # Modifies expectation so that the expected method must be called at most once.
1050
+ #
1051
+ # @example Expected method must be called at most once.
1052
+ # object = mock()
1053
+ # object.expects(:expected_method).at_most_once
1054
+ # object.expected_method
1055
+ # # => verify succeeds
1056
+ #
1057
+ # object = mock()
1058
+ # object.expects(:expected_method).at_most_once
1059
+ # 2.times { object.expected_method } # => unexpected invocation
1060
+ # @return [Expectation] the same expectation, thereby allowing invocations of other {Expectation} methods to be chained.
1061
+ #
1062
+ # source://mocha-1.14.0/lib/mocha/expectation.rb:186
1063
+ def at_most_once; end
1064
+
1065
+ # @private
1066
+ #
1067
+ # source://mocha-1.14.0/lib/mocha/expectation.rb:545
1068
+ def backtrace; end
1069
+
1070
+ # @private
1071
+ # @return [Boolean]
1072
+ #
1073
+ # source://mocha-1.14.0/lib/mocha/expectation.rb:582
1074
+ def in_correct_order?; end
1075
+
1076
+ # Constrains the expectation so that it must be invoked at the current point in the +sequence+.
1077
+ #
1078
+ # To expect a sequence of invocations, write the expectations in order and add the +in_sequence(sequence)+ clause to each one.
1079
+ #
1080
+ # Expectations in a +sequence+ can have any invocation count.
1081
+ #
1082
+ # If an expectation in a sequence is stubbed, rather than expected, it can be skipped in the +sequence+.
1083
+ #
1084
+ # An expected method can appear in multiple sequences.
1085
+ #
1086
+ # @example Ensure methods are invoked in a specified order.
1087
+ # breakfast = sequence('breakfast')
1088
+ #
1089
+ # egg = mock('egg')
1090
+ # egg.expects(:crack).in_sequence(breakfast)
1091
+ # egg.expects(:fry).in_sequence(breakfast)
1092
+ # egg.expects(:eat).in_sequence(breakfast)
1093
+ # @param sequence [Sequence] sequence in which expected method should appear.
1094
+ # @param sequences [*Array<Sequence>] more sequences in which expected method should appear.
1095
+ # @return [Expectation] the same expectation, thereby allowing invocations of other {Expectation} methods to be chained.
1096
+ # @see API#sequence
1097
+ #
1098
+ # source://mocha-1.14.0/lib/mocha/expectation.rb:539
1099
+ def in_sequence(sequence, *sequences); end
1100
+
1101
+ # @private
1102
+ #
1103
+ # source://mocha-1.14.0/lib/mocha/expectation.rb:625
1104
+ def inspect; end
1105
+
1106
+ # @private
1107
+ # @return [Boolean]
1108
+ #
1109
+ # source://mocha-1.14.0/lib/mocha/expectation.rb:597
1110
+ def invocations_allowed?; end
1111
+
1112
+ # @private
1113
+ #
1114
+ # source://mocha-1.14.0/lib/mocha/expectation.rb:607
1115
+ def invoke(invocation); end
1116
+
1117
+ # @private
1118
+ # @return [Boolean]
1119
+ #
1120
+ # source://mocha-1.14.0/lib/mocha/expectation.rb:592
1121
+ def match?(invocation); end
1122
+
1123
+ # @private
1124
+ # @return [Boolean]
1125
+ #
1126
+ # source://mocha-1.14.0/lib/mocha/expectation.rb:587
1127
+ def matches_method?(method_name); end
1128
+
1129
+ # @private
1130
+ #
1131
+ # source://mocha-1.14.0/lib/mocha/expectation.rb:642
1132
+ def method_signature; end
1133
+
1134
+ # @private
1135
+ #
1136
+ # source://mocha-1.14.0/lib/mocha/expectation.rb:632
1137
+ def mocha_inspect; end
1138
+
1139
+ # Modifies expectation so that when the expected method is called, it yields multiple times per invocation with the specified +parameter_groups+.
1140
+ #
1141
+ # If no block is provided, the method will still attempt to yield resulting in a +LocalJumpError+. Note that this is what would happen if a "real" (non-mock) method implementation tried to yield to a non-existent block.
1142
+ #
1143
+ # @example When +foreach+ is called, the stub will invoke the block twice, the first time it passes ['row1_col1', 'row1_col2'] as the parameters, and the second time it passes ['row2_col1', ''] as the parameters.
1144
+ # csv = mock()
1145
+ # csv.expects(:foreach).with("path/to/file.csv").multiple_yields(['row1_col1', 'row1_col2'], ['row2_col1', ''])
1146
+ # rows = []
1147
+ # csv.foreach { |row| rows << row }
1148
+ # rows # => [['row1_col1', 'row1_col2'], ['row2_col1', '']]
1149
+ # @example Yield different groups of parameters on different invocations of the expected method. Simulating a situation where the CSV file at 'path/to/file.csv' has been modified between the two calls to +foreach+.
1150
+ # csv = mock()
1151
+ # csv.stubs(:foreach).with("path/to/file.csv").multiple_yields(['old_row1_col1', 'old_row1_col2'], ['old_row2_col1', '']).then.multiple_yields(['new_row1_col1', ''], ['new_row2_col1', 'new_row2_col2'])
1152
+ # rows_from_first_invocation = []
1153
+ # rows_from_second_invocation = []
1154
+ # csv.foreach { |row| rows_from_first_invocation << row } # first invocation
1155
+ # csv.foreach { |row| rows_from_second_invocation << row } # second invocation
1156
+ # rows_from_first_invocation # => [['old_row1_col1', 'old_row1_col2'], ['old_row2_col1', '']]
1157
+ # rows_from_second_invocation # => [['new_row1_col1', ''], ['new_row2_col1', 'new_row2_col2']]
1158
+ # @param parameter_groups [*Array<Array>] each element of +parameter_groups+ should iself be an +Array+ representing the parameters to be passed to the block for a single yield. Any element of +parameter_groups+ that is not an +Array+ is wrapped in an +Array+.
1159
+ # @return [Expectation] the same expectation, thereby allowing invocations of other {Expectation} methods to be chained.
1160
+ # @see #then
1161
+ #
1162
+ # source://mocha-1.14.0/lib/mocha/expectation.rb:326
1163
+ def multiple_yields(*parameter_groups); end
1164
+
1165
+ # Modifies expectation so that the expected method must never be called.
1166
+ #
1167
+ # @example Expected method must never be called.
1168
+ # object = mock()
1169
+ # object.expects(:expected_method).never
1170
+ # object.expected_method # => unexpected invocation
1171
+ #
1172
+ # object = mock()
1173
+ # object.expects(:expected_method).never
1174
+ # # => verify succeeds
1175
+ # @return [Expectation] the same expectation, thereby allowing invocations of other {Expectation} methods to be chained.
1176
+ #
1177
+ # source://mocha-1.14.0/lib/mocha/expectation.rb:112
1178
+ def never; end
1179
+
1180
+ # Modifies expectation so that the expected method must be called exactly once.
1181
+ #
1182
+ # Note that this is the default behaviour for an expectation, but you may wish to use it for clarity/emphasis.
1183
+ #
1184
+ # @example Expected method must be invoked exactly once.
1185
+ # object = mock()
1186
+ # object.expects(:expected_method).once
1187
+ # object.expected_method
1188
+ # # => verify succeeds
1189
+ #
1190
+ # object = mock()
1191
+ # object.expects(:expected_method).once
1192
+ # object.expected_method
1193
+ # object.expected_method # => unexpected invocation
1194
+ #
1195
+ # object = mock()
1196
+ # object.expects(:expected_method).once
1197
+ # # => verify fails
1198
+ # @return [Expectation] the same expectation, thereby allowing invocations of other {Expectation} methods to be chained.
1199
+ #
1200
+ # source://mocha-1.14.0/lib/mocha/expectation.rb:95
1201
+ def once; end
1202
+
1203
+ # @private
1204
+ #
1205
+ # source://mocha-1.14.0/lib/mocha/expectation.rb:577
1206
+ def perform_side_effects; end
1207
+
1208
+ # Modifies expectation so that when the expected method is called, it raises the specified +exception+ with the specified +message+ i.e. calls +Kernel#raise(exception, message)+.
1209
+ #
1210
+ # @example Raise specified exception if expected method is invoked.
1211
+ # object = stub()
1212
+ # object.stubs(:expected_method).raises(Exception, 'message')
1213
+ # object.expected_method # => raises exception of class Exception and with message 'message'
1214
+ # @example Raise custom exception with extra constructor parameters by passing in an instance of the exception.
1215
+ # object = stub()
1216
+ # object.stubs(:expected_method).raises(MyException.new('message', 1, 2, 3))
1217
+ # object.expected_method # => raises the specified instance of MyException
1218
+ # @example Raise different exceptions on consecutive invocations of the expected method.
1219
+ # object = stub()
1220
+ # object.stubs(:expected_method).raises(Exception1).then.raises(Exception2)
1221
+ # object.expected_method # => raises exception of class Exception1
1222
+ # object.expected_method # => raises exception of class Exception2
1223
+ # @example Raise an exception on first invocation of expected method and then return values on subsequent invocations.
1224
+ # object = stub()
1225
+ # object.stubs(:expected_method).raises(Exception).then.returns(2, 3)
1226
+ # object.expected_method # => raises exception of class Exception1
1227
+ # object.expected_method # => 2
1228
+ # object.expected_method # => 3
1229
+ # @overload raises
1230
+ # @overload raises
1231
+ # @overload raises
1232
+ # @param exception [Class, Exception, String, #exception] exception to be raised or message to be passed to RuntimeError.
1233
+ # @param message [String] exception message.
1234
+ # @return [Expectation] the same expectation, thereby allowing invocations of other {Expectation} methods to be chained.
1235
+ # @see Kernel#raise
1236
+ # @see #then
1237
+ #
1238
+ # source://mocha-1.14.0/lib/mocha/expectation.rb:413
1239
+ def raises(exception = T.unsafe(nil), message = T.unsafe(nil)); end
1240
+
1241
+ # Modifies expectation so that when the expected method is called, it returns the specified +value+.
1242
+ #
1243
+ # @example Return the same value on every invocation.
1244
+ # object = mock()
1245
+ # object.stubs(:stubbed_method).returns('result')
1246
+ # object.stubbed_method # => 'result'
1247
+ # object.stubbed_method # => 'result'
1248
+ # @example Return a different value on consecutive invocations.
1249
+ # object = mock()
1250
+ # object.stubs(:stubbed_method).returns(1, 2)
1251
+ # object.stubbed_method # => 1
1252
+ # object.stubbed_method # => 2
1253
+ # @example Alternative way to return a different value on consecutive invocations.
1254
+ # object = mock()
1255
+ # object.stubs(:expected_method).returns(1, 2).then.returns(3)
1256
+ # object.expected_method # => 1
1257
+ # object.expected_method # => 2
1258
+ # object.expected_method # => 3
1259
+ # @example May be called in conjunction with {#raises} on the same expectation.
1260
+ # object = mock()
1261
+ # object.stubs(:expected_method).returns(1, 2).then.raises(Exception)
1262
+ # object.expected_method # => 1
1263
+ # object.expected_method # => 2
1264
+ # object.expected_method # => raises exception of class Exception1
1265
+ # @example Note that in Ruby a method returning multiple values is exactly equivalent to a method returning an +Array+ of those values.
1266
+ # object = mock()
1267
+ # object.stubs(:expected_method).returns([1, 2])
1268
+ # x, y = object.expected_method
1269
+ # x # => 1
1270
+ # y # => 2
1271
+ # @overload returns
1272
+ # @overload returns
1273
+ # @return [Expectation] the same expectation, thereby allowing invocations of other {Expectation} methods to be chained.
1274
+ # @see #then
1275
+ #
1276
+ # source://mocha-1.14.0/lib/mocha/expectation.rb:373
1277
+ def returns(*values); end
1278
+
1279
+ # @private
1280
+ # @return [Boolean]
1281
+ #
1282
+ # source://mocha-1.14.0/lib/mocha/expectation.rb:602
1283
+ def satisfied?; end
1284
+
1285
+ # @example Using {#then} as syntactic sugar when specifying values to be returned and exceptions to be raised on consecutive invocations of the expected method.
1286
+ # object = mock()
1287
+ # object.stubs(:expected_method).returns(1, 2).then.raises(Exception).then.returns(4)
1288
+ # object.expected_method # => 1
1289
+ # object.expected_method # => 2
1290
+ # object.expected_method # => raises exception of class Exception
1291
+ # object.expected_method # => 4
1292
+ # @example Using {#then} to change the +state+ of a +state_machine+ on the invocation of an expected method.
1293
+ # power = states('power').starts_as('off')
1294
+ #
1295
+ # radio = mock('radio')
1296
+ # radio.expects(:switch_on).then(power.is('on'))
1297
+ # radio.expects(:select_channel).with('BBC Radio 4').when(power.is('on'))
1298
+ # radio.expects(:adjust_volume).with(+5).when(power.is('on'))
1299
+ # radio.expects(:select_channel).with('BBC World Service').when(power.is('on'))
1300
+ # radio.expects(:adjust_volume).with(-5).when(power.is('on'))
1301
+ # radio.expects(:switch_off).then(power.is('off'))
1302
+ # @overload then
1303
+ # @overload then
1304
+ # @return [Expectation] the same expectation, thereby allowing invocations of other {Expectation} methods to be chained.
1305
+ #
1306
+ # source://mocha-1.14.0/lib/mocha/expectation.rb:487
1307
+ def then(state = T.unsafe(nil)); end
1308
+
1309
+ # Modifies expectation so that when the expected method is called, it throws the specified +tag+ with the specific return value +object+ i.e. calls +Kernel#throw(tag, object)+.
1310
+ #
1311
+ # @example Throw tag when expected method is invoked.
1312
+ # object = stub()
1313
+ # object.stubs(:expected_method).throws(:done)
1314
+ # object.expected_method # => throws tag :done
1315
+ # @example Throw tag with return value +object+ c.f. +Kernel#throw+.
1316
+ # object = stub()
1317
+ # object.stubs(:expected_method).throws(:done, 'result')
1318
+ # object.expected_method # => throws tag :done and causes catch block to return 'result'
1319
+ # @example Throw different tags on consecutive invocations of the expected method.
1320
+ # object = stub()
1321
+ # object.stubs(:expected_method).throws(:done).then.throws(:continue)
1322
+ # object.expected_method # => throws :done
1323
+ # object.expected_method # => throws :continue
1324
+ # @example Throw tag on first invocation of expected method and then return values for subsequent invocations.
1325
+ # object = stub()
1326
+ # object.stubs(:expected_method).throws(:done).then.returns(2, 3)
1327
+ # object.expected_method # => throws :done
1328
+ # object.expected_method # => 2
1329
+ # object.expected_method # => 3
1330
+ # @overload throw
1331
+ # @overload throw
1332
+ # @param tag [Symbol, String] tag to throw to transfer control to the active catch block.
1333
+ # @param object [Object] return value for the catch block.
1334
+ # @return [Expectation] the same expectation, thereby allowing invocations of other {Expectation} methods to be chained.
1335
+ # @see Kernel#throw
1336
+ # @see #then
1337
+ #
1338
+ # source://mocha-1.14.0/lib/mocha/expectation.rb:452
1339
+ def throws(tag, object = T.unsafe(nil)); end
1340
+
1341
+ # Modifies expectation so that the number of calls to the expected method must be within a specific +range+.
1342
+ #
1343
+ # @example Specifying a specific number of expected invocations.
1344
+ # object = mock()
1345
+ # object.expects(:expected_method).times(3)
1346
+ # 3.times { object.expected_method }
1347
+ # # => verify succeeds
1348
+ #
1349
+ # object = mock()
1350
+ # object.expects(:expected_method).times(3)
1351
+ # 2.times { object.expected_method }
1352
+ # # => verify fails
1353
+ # @example Specifying a range in the number of expected invocations.
1354
+ # object = mock()
1355
+ # object.expects(:expected_method).times(2..4)
1356
+ # 3.times { object.expected_method }
1357
+ # # => verify succeeds
1358
+ #
1359
+ # object = mock()
1360
+ # object.expects(:expected_method).times(2..4)
1361
+ # object.expected_method
1362
+ # # => verify fails
1363
+ # @param range [Range, Integer] specifies the allowable range in the number of expected invocations.
1364
+ # @return [Expectation] the same expectation, thereby allowing invocations of other {Expectation} methods to be chained.
1365
+ #
1366
+ # source://mocha-1.14.0/lib/mocha/expectation.rb:44
1367
+ def times(range); end
1368
+
1369
+ # Modifies expectation so that the expected method must be called exactly twice.
1370
+ #
1371
+ # @example Expected method must be invoked exactly twice.
1372
+ # object = mock()
1373
+ # object.expects(:expected_method).twice
1374
+ # object.expected_method
1375
+ # object.expected_method
1376
+ # # => verify succeeds
1377
+ #
1378
+ # object = mock()
1379
+ # object.expects(:expected_method).twice
1380
+ # object.expected_method
1381
+ # object.expected_method
1382
+ # object.expected_method # => unexpected invocation
1383
+ #
1384
+ # object = mock()
1385
+ # object.expects(:expected_method).twice
1386
+ # object.expected_method
1387
+ # # => verify fails
1388
+ # @return [Expectation] the same expectation, thereby allowing invocations of other {Expectation} methods to be chained.
1389
+ #
1390
+ # source://mocha-1.14.0/lib/mocha/expectation.rb:70
1391
+ def twice; end
1392
+
1393
+ # @private
1394
+ # @return [Boolean]
1395
+ #
1396
+ # source://mocha-1.14.0/lib/mocha/expectation.rb:620
1397
+ def used?; end
1398
+
1399
+ # @private
1400
+ # @return [Boolean]
1401
+ #
1402
+ # source://mocha-1.14.0/lib/mocha/expectation.rb:614
1403
+ def verified?(assertion_counter = T.unsafe(nil)); end
1404
+
1405
+ # Constrains the expectation to occur only when the +state_machine+ is in the state specified by +state_predicate+.
1406
+ #
1407
+ # @example Using {#when} to only allow invocation of methods when "power" state machine is in the "on" state.
1408
+ # power = states('power').starts_as('off')
1409
+ #
1410
+ # radio = mock('radio')
1411
+ # radio.expects(:switch_on).then(power.is('on'))
1412
+ # radio.expects(:select_channel).with('BBC Radio 4').when(power.is('on'))
1413
+ # radio.expects(:adjust_volume).with(+5).when(power.is('on'))
1414
+ # radio.expects(:select_channel).with('BBC World Service').when(power.is('on'))
1415
+ # radio.expects(:adjust_volume).with(-5).when(power.is('on'))
1416
+ # radio.expects(:switch_off).then(power.is('off'))
1417
+ # @param state_predicate [StateMachine::StatePredicate] +state_machine.is(state_name)+ provides a mechanism to determine whether the +state_machine+ is in the state specified by +state_predicate+ when the expected method is invoked.
1418
+ # @return [Expectation] the same expectation, thereby allowing invocations of other {Expectation} methods to be chained.
1419
+ # @see API#states
1420
+ # @see StateMachine
1421
+ # @see #then
1422
+ #
1423
+ # source://mocha-1.14.0/lib/mocha/expectation.rb:511
1424
+ def when(state_predicate); end
1425
+
1426
+ # Modifies expectation so that the expected method must be called with +expected_parameters+.
1427
+ #
1428
+ # May be used with parameter matchers in {ParameterMatchers}.
1429
+ #
1430
+ # @example Expected method must be called with expected parameters.
1431
+ # object = mock()
1432
+ # object.expects(:expected_method).with(:param1, :param2)
1433
+ # object.expected_method(:param1, :param2)
1434
+ # # => verify succeeds
1435
+ #
1436
+ # object = mock()
1437
+ # object.expects(:expected_method).with(:param1, :param2)
1438
+ # object.expected_method(:param3)
1439
+ # # => verify fails
1440
+ # @example Expected method must be called with a value divisible by 4.
1441
+ # object = mock()
1442
+ # object.expects(:expected_method).with() { |value| value % 4 == 0 }
1443
+ # object.expected_method(16)
1444
+ # # => verify succeeds
1445
+ #
1446
+ # object = mock()
1447
+ # object.expects(:expected_method).with() { |value| value % 4 == 0 }
1448
+ # object.expected_method(17)
1449
+ # # => verify fails
1450
+ # @param expected_parameters [*Array] parameters expected.
1451
+ # @return [Expectation] the same expectation, thereby allowing invocations of other {Expectation} methods to be chained.
1452
+ # @yield optional block specifying custom matching.
1453
+ # @yieldparam actual_parameters [*Array] parameters with which expected method was invoked.
1454
+ # @yieldreturn [Boolean] +true+ if +actual_parameters+ are acceptable.
1455
+ #
1456
+ # source://mocha-1.14.0/lib/mocha/expectation.rb:221
1457
+ def with(*expected_parameters, &matching_block); end
1458
+
1459
+ # Modifies expectation so that the expected method must be called with a block.
1460
+ #
1461
+ # @example Expected method must be called with a block.
1462
+ # object = mock()
1463
+ # object.expects(:expected_method).with_block_given
1464
+ # object.expected_method { 1 + 1 }
1465
+ # # => verify succeeds
1466
+ #
1467
+ # object = mock()
1468
+ # object.expects(:expected_method).with_block_given
1469
+ # object.expected_method
1470
+ # # => verify fails
1471
+ # @return [Expectation] the same expectation, thereby allowing invocations of other {Expectation} methods to be chained.
1472
+ #
1473
+ # source://mocha-1.14.0/lib/mocha/expectation.rb:240
1474
+ def with_block_given; end
1475
+
1476
+ # Modifies expectation so that the expected method must be called without a block.
1477
+ #
1478
+ # @example Expected method must be called without a block.
1479
+ # object = mock()
1480
+ # object.expects(:expected_method).with_no_block_given
1481
+ # object.expected_method
1482
+ # # => verify succeeds
1483
+ #
1484
+ # object = mock()
1485
+ # object.expects(:expected_method).with_block_given
1486
+ # object.expected_method { 1 + 1 }
1487
+ # # => verify fails
1488
+ # @return [Expectation] the same expectation, thereby allowing invocations of other {Expectation} methods to be chained.
1489
+ #
1490
+ # source://mocha-1.14.0/lib/mocha/expectation.rb:259
1491
+ def with_no_block_given; end
1492
+
1493
+ # Modifies expectation so that when the expected method is called, it yields to the block with the specified +parameters+.
1494
+ #
1495
+ # If no +parameters+ are specified, it yields to the block without any parameters.
1496
+ #
1497
+ # If no block is provided, the method will still attempt to yield resulting in a +LocalJumpError+. Note that this is what would happen if a "real" (non-mock) method implementation tried to yield to a non-existent block.
1498
+ #
1499
+ # May be called multiple times on the same expectation for consecutive invocations.
1500
+ #
1501
+ # @example Yield when expected method is invoked.
1502
+ # benchmark = mock()
1503
+ # benchmark.expects(:measure).yields
1504
+ # yielded = false
1505
+ # benchmark.measure { yielded = true }
1506
+ # yielded # => true
1507
+ # @example Yield parameters when expected method is invoked.
1508
+ # fibonacci = mock()
1509
+ # fibonacci.expects(:next_pair).yields(0, 1)
1510
+ # sum = 0
1511
+ # fibonacci.next_pair { |first, second| sum = first + second }
1512
+ # sum # => 1
1513
+ # @example Yield different parameters on different invocations of the expected method.
1514
+ # fibonacci = mock()
1515
+ # fibonacci.expects(:next_pair).yields(0, 1).then.yields(1, 1)
1516
+ # sum = 0
1517
+ # fibonacci.next_pair { |first, second| sum = first + second }
1518
+ # sum # => 1
1519
+ # fibonacci.next_pair { |first, second| sum = first + second }
1520
+ # sum # => 2
1521
+ # @param parameters [*Array] parameters to be yielded.
1522
+ # @return [Expectation] the same expectation, thereby allowing invocations of other {Expectation} methods to be chained.
1523
+ # @see #then
1524
+ #
1525
+ # source://mocha-1.14.0/lib/mocha/expectation.rb:298
1526
+ def yields(*parameters); end
1527
+ end
1528
+
1529
+ # Default exception class raised when an unexpected invocation or an unsatisfied expectation occurs.
1530
+ #
1531
+ # Authors of test libraries may use +Mocha::ExpectationErrorFactory+ to have Mocha raise a different exception.
1532
+ #
1533
+ # @see Mocha::ExpectationErrorFactory
1534
+ #
1535
+ # source://mocha-1.14.0/lib/mocha/expectation_error.rb:7
1536
+ class Mocha::ExpectationError < ::Exception; end
1537
+
1538
+ # This factory determines what class of exception should be raised when Mocha detects a test failure.
1539
+ #
1540
+ # This class should only be used by authors of test libraries and not by typical "users" of Mocha.
1541
+ #
1542
+ # For example, it is used by +Mocha::Integration::MiniTest::Adapter+ in order to have Mocha raise a +MiniTest::Assertion+ which can then be sensibly handled by +MiniTest::Unit::TestCase+.
1543
+ #
1544
+ # @see Mocha::Integration::MiniTest::Adapter
1545
+ #
1546
+ # source://mocha-1.14.0/lib/mocha/expectation_error_factory.rb:12
1547
+ class Mocha::ExpectationErrorFactory
1548
+ class << self
1549
+ # @private
1550
+ #
1551
+ # source://mocha-1.14.0/lib/mocha/expectation_error_factory.rb:26
1552
+ def build(message = T.unsafe(nil), backtrace = T.unsafe(nil)); end
1553
+
1554
+ # Determines what class of exception should be raised when Mocha detects a test failure.
1555
+ #
1556
+ # This attribute may be set by authors of test libraries in order to have Mocha raise exceptions of a specific class when there is an unexpected invocation or an unsatisfied expectation.
1557
+ #
1558
+ # By default a +Mocha::ExpectationError+ will be raised.
1559
+ #
1560
+ # @return [Exception] class of exception to be raised when an expectation error occurs
1561
+ # @see Mocha::ExpectationError
1562
+ #
1563
+ # source://mocha-1.14.0/lib/mocha/expectation_error_factory.rb:23
1564
+ def exception_class; end
1565
+
1566
+ # Sets the attribute exception_class
1567
+ #
1568
+ # @param value the value to set the attribute exception_class to.
1569
+ #
1570
+ # source://mocha-1.14.0/lib/mocha/expectation_error_factory.rb:23
1571
+ def exception_class=(_arg0); end
1572
+ end
1573
+ end
1574
+
1575
+ # source://mocha-1.14.0/lib/mocha/expectation_list.rb:2
1576
+ class Mocha::ExpectationList
1577
+ # @return [ExpectationList] a new instance of ExpectationList
1578
+ #
1579
+ # source://mocha-1.14.0/lib/mocha/expectation_list.rb:3
1580
+ def initialize(expectations = T.unsafe(nil)); end
1581
+
1582
+ # source://mocha-1.14.0/lib/mocha/expectation_list.rb:48
1583
+ def +(other); end
1584
+
1585
+ # source://mocha-1.14.0/lib/mocha/expectation_list.rb:7
1586
+ def add(expectation); end
1587
+
1588
+ # @return [Boolean]
1589
+ #
1590
+ # source://mocha-1.14.0/lib/mocha/expectation_list.rb:44
1591
+ def any?; end
1592
+
1593
+ # source://mocha-1.14.0/lib/mocha/expectation_list.rb:40
1594
+ def length; end
1595
+
1596
+ # source://mocha-1.14.0/lib/mocha/expectation_list.rb:20
1597
+ def match(invocation); end
1598
+
1599
+ # source://mocha-1.14.0/lib/mocha/expectation_list.rb:24
1600
+ def match_allowing_invocation(invocation); end
1601
+
1602
+ # @return [Boolean]
1603
+ #
1604
+ # source://mocha-1.14.0/lib/mocha/expectation_list.rb:16
1605
+ def matches_method?(method_name); end
1606
+
1607
+ # source://mocha-1.14.0/lib/mocha/expectation_list.rb:12
1608
+ def remove_all_matching_method(method_name); end
1609
+
1610
+ # source://mocha-1.14.0/lib/mocha/expectation_list.rb:32
1611
+ def to_a; end
1612
+
1613
+ # source://mocha-1.14.0/lib/mocha/expectation_list.rb:36
1614
+ def to_set; end
1615
+
1616
+ # @return [Boolean]
1617
+ #
1618
+ # source://mocha-1.14.0/lib/mocha/expectation_list.rb:28
1619
+ def verified?(assertion_counter = T.unsafe(nil)); end
1620
+
1621
+ private
1622
+
1623
+ # source://mocha-1.14.0/lib/mocha/expectation_list.rb:54
1624
+ def matching_expectations(invocation); end
1625
+ end
1626
+
1627
+ # Integration hooks for test library authors.
1628
+ #
1629
+ # The methods in this module should be called from test libraries wishing to integrate with Mocha.
1630
+ #
1631
+ # This module is provided as part of the +Mocha::API+ module and is therefore part of the public API, but should only be used by authors of test libraries and not by typical "users" of Mocha.
1632
+ #
1633
+ # Integration with Test::Unit and MiniTest are provided as part of Mocha, because they are (or were once) part of the Ruby standard library. Integration with other test libraries is not provided as *part* of Mocha, but is supported by means of the methods in this module.
1634
+ #
1635
+ # See the code in the +Adapter+ modules for examples of how to use the methods in this module. +Mocha::ExpectationErrorFactory+ may be used if you want +Mocha+ to raise a different type of exception.
1636
+ #
1637
+ # @see Mocha::Integration::TestUnit::Adapter
1638
+ # @see Mocha::Integration::MiniTest::Adapter
1639
+ # @see Mocha::ExpectationErrorFactory
1640
+ # @see Mocha::API
1641
+ #
1642
+ # source://mocha-1.14.0/lib/mocha/hooks.rb:18
1643
+ module Mocha::Hooks
1644
+ # Prepares Mocha before a test (only for use by authors of test libraries).
1645
+ #
1646
+ # This method should be called before each individual test starts (including before any "setup" code).
1647
+ #
1648
+ # source://mocha-1.14.0/lib/mocha/hooks.rb:22
1649
+ def mocha_setup; end
1650
+
1651
+ # Resets Mocha after a test (only for use by authors of test libraries).
1652
+ #
1653
+ # This method should be called after each individual test has finished (including after any "teardown" code).
1654
+ #
1655
+ # source://mocha-1.14.0/lib/mocha/hooks.rb:38
1656
+ def mocha_teardown; end
1657
+
1658
+ # Verifies that all mock expectations have been met (only for use by authors of test libraries).
1659
+ #
1660
+ # This is equivalent to a series of "assertions".
1661
+ #
1662
+ # This method should be called at the end of each individual test, before it has been determined whether or not the test has passed.
1663
+ #
1664
+ # source://mocha-1.14.0/lib/mocha/hooks.rb:31
1665
+ def mocha_verify(assertion_counter = T.unsafe(nil)); end
1666
+ end
1667
+
1668
+ # source://mocha-1.14.0/lib/mocha/names.rb:12
1669
+ class Mocha::ImpersonatingAnyInstanceName
1670
+ # @return [ImpersonatingAnyInstanceName] a new instance of ImpersonatingAnyInstanceName
1671
+ #
1672
+ # source://mocha-1.14.0/lib/mocha/names.rb:13
1673
+ def initialize(klass); end
1674
+
1675
+ # source://mocha-1.14.0/lib/mocha/names.rb:17
1676
+ def mocha_inspect; end
1677
+ end
1678
+
1679
+ # source://mocha-1.14.0/lib/mocha/names.rb:2
1680
+ class Mocha::ImpersonatingName
1681
+ # @return [ImpersonatingName] a new instance of ImpersonatingName
1682
+ #
1683
+ # source://mocha-1.14.0/lib/mocha/names.rb:3
1684
+ def initialize(object); end
1685
+
1686
+ # source://mocha-1.14.0/lib/mocha/names.rb:7
1687
+ def mocha_inspect; end
1688
+ end
1689
+
1690
+ # source://mocha-1.14.0/lib/mocha/in_state_ordering_constraint.rb:2
1691
+ class Mocha::InStateOrderingConstraint
1692
+ # @return [InStateOrderingConstraint] a new instance of InStateOrderingConstraint
1693
+ #
1694
+ # source://mocha-1.14.0/lib/mocha/in_state_ordering_constraint.rb:3
1695
+ def initialize(state_predicate); end
1696
+
1697
+ # @return [Boolean]
1698
+ #
1699
+ # source://mocha-1.14.0/lib/mocha/in_state_ordering_constraint.rb:7
1700
+ def allows_invocation_now?; end
1701
+
1702
+ # source://mocha-1.14.0/lib/mocha/in_state_ordering_constraint.rb:11
1703
+ def mocha_inspect; end
1704
+ end
1705
+
1706
+ # source://mocha-1.14.0/lib/mocha/inspect.rb:4
1707
+ module Mocha::Inspect; end
1708
+
1709
+ # source://mocha-1.14.0/lib/mocha/inspect.rb:13
1710
+ module Mocha::Inspect::ArrayMethods
1711
+ # source://mocha-1.14.0/lib/mocha/inspect.rb:14
1712
+ def mocha_inspect(wrapped = T.unsafe(nil)); end
1713
+ end
1714
+
1715
+ # source://mocha-1.14.0/lib/mocha/inspect.rb:33
1716
+ module Mocha::Inspect::DateMethods
1717
+ # source://mocha-1.14.0/lib/mocha/inspect.rb:34
1718
+ def mocha_inspect; end
1719
+ end
1720
+
1721
+ # source://mocha-1.14.0/lib/mocha/inspect.rb:20
1722
+ module Mocha::Inspect::HashMethods
1723
+ # source://mocha-1.14.0/lib/mocha/inspect.rb:21
1724
+ def mocha_inspect(wrapped = T.unsafe(nil)); end
1725
+ end
1726
+
1727
+ # source://mocha-1.14.0/lib/mocha/inspect.rb:5
1728
+ module Mocha::Inspect::ObjectMethods
1729
+ # source://mocha-1.14.0/lib/mocha/inspect.rb:6
1730
+ def mocha_inspect; end
1731
+ end
1732
+
1733
+ # source://mocha-1.14.0/lib/mocha/inspect.rb:27
1734
+ module Mocha::Inspect::TimeMethods
1735
+ # source://mocha-1.14.0/lib/mocha/inspect.rb:28
1736
+ def mocha_inspect; end
1737
+ end
1738
+
1739
+ # source://mocha-1.14.0/lib/mocha/instance_method.rb:4
1740
+ class Mocha::InstanceMethod < ::Mocha::StubbedMethod
1741
+ private
1742
+
1743
+ # source://mocha-1.14.0/lib/mocha/instance_method.rb:11
1744
+ def method_body(method); end
1745
+
1746
+ # source://mocha-1.14.0/lib/mocha/instance_method.rb:7
1747
+ def mock_owner; end
1748
+
1749
+ # source://mocha-1.14.0/lib/mocha/instance_method.rb:19
1750
+ def original_method_owner; end
1751
+
1752
+ # source://mocha-1.14.0/lib/mocha/instance_method.rb:15
1753
+ def stubbee_method(method_name); end
1754
+ end
1755
+
1756
+ # source://mocha-1.14.0/lib/mocha/integration/mini_test/nothing.rb:2
1757
+ module Mocha::Integration; end
1758
+
1759
+ # source://mocha-1.14.0/lib/mocha/integration/assertion_counter.rb:3
1760
+ class Mocha::Integration::AssertionCounter
1761
+ # @return [AssertionCounter] a new instance of AssertionCounter
1762
+ #
1763
+ # source://mocha-1.14.0/lib/mocha/integration/assertion_counter.rb:4
1764
+ def initialize(test_case); end
1765
+
1766
+ # source://mocha-1.14.0/lib/mocha/integration/assertion_counter.rb:8
1767
+ def increment; end
1768
+ end
1769
+
1770
+ # source://mocha-1.14.0/lib/mocha/integration/mini_test/nothing.rb:3
1771
+ module Mocha::Integration::MiniTest
1772
+ class << self
1773
+ # source://mocha-1.14.0/lib/mocha/integration/mini_test.rb:22
1774
+ def activate; end
1775
+
1776
+ # source://mocha-1.14.0/lib/mocha/integration/mini_test/exception_translation.rb:6
1777
+ def translate(exception); end
1778
+ end
1779
+ end
1780
+
1781
+ # Integrates Mocha into recent versions of MiniTest.
1782
+ #
1783
+ # See the source code for an example of how to integrate Mocha into a test library.
1784
+ #
1785
+ # source://mocha-1.14.0/lib/mocha/integration/mini_test/adapter.rb:11
1786
+ module Mocha::Integration::MiniTest::Adapter
1787
+ include ::Mocha::ParameterMatchers
1788
+ include ::Mocha::Hooks
1789
+ include ::Mocha::API
1790
+
1791
+ # @private
1792
+ #
1793
+ # source://mocha-1.14.0/lib/mocha/integration/mini_test/adapter.rb:45
1794
+ def after_teardown; end
1795
+
1796
+ # @private
1797
+ #
1798
+ # source://mocha-1.14.0/lib/mocha/integration/mini_test/adapter.rb:30
1799
+ def before_setup; end
1800
+
1801
+ # @private
1802
+ #
1803
+ # source://mocha-1.14.0/lib/mocha/integration/mini_test/adapter.rb:36
1804
+ def before_teardown; end
1805
+
1806
+ class << self
1807
+ # @private
1808
+ # @return [Boolean]
1809
+ #
1810
+ # source://mocha-1.14.0/lib/mocha/integration/mini_test/adapter.rb:15
1811
+ def applicable_to?(mini_test_version); end
1812
+
1813
+ # @private
1814
+ #
1815
+ # source://mocha-1.14.0/lib/mocha/integration/mini_test/adapter.rb:20
1816
+ def description; end
1817
+
1818
+ # @private
1819
+ # @private
1820
+ #
1821
+ # source://mocha-1.14.0/lib/mocha/integration/mini_test/adapter.rb:25
1822
+ def included(_mod); end
1823
+ end
1824
+ end
1825
+
1826
+ # source://mocha-1.14.0/lib/mocha/integration/mini_test/nothing.rb:4
1827
+ module Mocha::Integration::MiniTest::Nothing
1828
+ class << self
1829
+ # @return [Boolean]
1830
+ #
1831
+ # source://mocha-1.14.0/lib/mocha/integration/mini_test/nothing.rb:5
1832
+ def applicable_to?(_test_unit_version, _ruby_version = T.unsafe(nil)); end
1833
+
1834
+ # source://mocha-1.14.0/lib/mocha/integration/mini_test/nothing.rb:9
1835
+ def description; end
1836
+
1837
+ # @private
1838
+ #
1839
+ # source://mocha-1.14.0/lib/mocha/integration/mini_test/nothing.rb:13
1840
+ def included(_mod); end
1841
+ end
1842
+ end
1843
+
1844
+ # source://mocha-1.14.0/lib/mocha/integration/mini_test/version_13.rb:8
1845
+ module Mocha::Integration::MiniTest::Version13
1846
+ include ::Mocha::API
1847
+
1848
+ class << self
1849
+ # @return [Boolean]
1850
+ #
1851
+ # source://mocha-1.14.0/lib/mocha/integration/mini_test/version_13.rb:9
1852
+ def applicable_to?(mini_test_version); end
1853
+
1854
+ # source://mocha-1.14.0/lib/mocha/integration/mini_test/version_13.rb:13
1855
+ def description; end
1856
+
1857
+ # @private
1858
+ #
1859
+ # source://mocha-1.14.0/lib/mocha/integration/mini_test/version_13.rb:17
1860
+ def included(mod); end
1861
+ end
1862
+ end
1863
+
1864
+ # source://mocha-1.14.0/lib/mocha/integration/mini_test/version_13.rb:21
1865
+ module Mocha::Integration::MiniTest::Version13::RunMethodPatch
1866
+ # source://mocha-1.14.0/lib/mocha/integration/mini_test/version_13.rb:23
1867
+ def run(runner); end
1868
+ end
1869
+
1870
+ # source://mocha-1.14.0/lib/mocha/integration/mini_test/version_140.rb:8
1871
+ module Mocha::Integration::MiniTest::Version140
1872
+ include ::Mocha::API
1873
+
1874
+ class << self
1875
+ # @return [Boolean]
1876
+ #
1877
+ # source://mocha-1.14.0/lib/mocha/integration/mini_test/version_140.rb:9
1878
+ def applicable_to?(mini_test_version); end
1879
+
1880
+ # source://mocha-1.14.0/lib/mocha/integration/mini_test/version_140.rb:13
1881
+ def description; end
1882
+
1883
+ # @private
1884
+ #
1885
+ # source://mocha-1.14.0/lib/mocha/integration/mini_test/version_140.rb:17
1886
+ def included(mod); end
1887
+ end
1888
+ end
1889
+
1890
+ # source://mocha-1.14.0/lib/mocha/integration/mini_test/version_140.rb:21
1891
+ module Mocha::Integration::MiniTest::Version140::RunMethodPatch
1892
+ # source://mocha-1.14.0/lib/mocha/integration/mini_test/version_140.rb:23
1893
+ def run(runner); end
1894
+ end
1895
+
1896
+ # source://mocha-1.14.0/lib/mocha/integration/mini_test/version_141.rb:8
1897
+ module Mocha::Integration::MiniTest::Version141
1898
+ include ::Mocha::API
1899
+
1900
+ class << self
1901
+ # @return [Boolean]
1902
+ #
1903
+ # source://mocha-1.14.0/lib/mocha/integration/mini_test/version_141.rb:9
1904
+ def applicable_to?(mini_test_version); end
1905
+
1906
+ # source://mocha-1.14.0/lib/mocha/integration/mini_test/version_141.rb:13
1907
+ def description; end
1908
+
1909
+ # @private
1910
+ #
1911
+ # source://mocha-1.14.0/lib/mocha/integration/mini_test/version_141.rb:17
1912
+ def included(mod); end
1913
+ end
1914
+ end
1915
+
1916
+ # source://mocha-1.14.0/lib/mocha/integration/mini_test/version_141.rb:21
1917
+ module Mocha::Integration::MiniTest::Version141::RunMethodPatch
1918
+ # source://mocha-1.14.0/lib/mocha/integration/mini_test/version_141.rb:23
1919
+ def run(runner); end
1920
+ end
1921
+
1922
+ # source://mocha-1.14.0/lib/mocha/integration/mini_test/version_142_to_172.rb:8
1923
+ module Mocha::Integration::MiniTest::Version142To172
1924
+ include ::Mocha::API
1925
+
1926
+ class << self
1927
+ # @return [Boolean]
1928
+ #
1929
+ # source://mocha-1.14.0/lib/mocha/integration/mini_test/version_142_to_172.rb:9
1930
+ def applicable_to?(mini_test_version); end
1931
+
1932
+ # source://mocha-1.14.0/lib/mocha/integration/mini_test/version_142_to_172.rb:13
1933
+ def description; end
1934
+
1935
+ # @private
1936
+ #
1937
+ # source://mocha-1.14.0/lib/mocha/integration/mini_test/version_142_to_172.rb:17
1938
+ def included(mod); end
1939
+ end
1940
+ end
1941
+
1942
+ # source://mocha-1.14.0/lib/mocha/integration/mini_test/version_142_to_172.rb:21
1943
+ module Mocha::Integration::MiniTest::Version142To172::RunMethodPatch
1944
+ # source://mocha-1.14.0/lib/mocha/integration/mini_test/version_142_to_172.rb:23
1945
+ def run(runner); end
1946
+ end
1947
+
1948
+ # source://mocha-1.14.0/lib/mocha/integration/mini_test/version_200.rb:8
1949
+ module Mocha::Integration::MiniTest::Version200
1950
+ include ::Mocha::API
1951
+
1952
+ class << self
1953
+ # @return [Boolean]
1954
+ #
1955
+ # source://mocha-1.14.0/lib/mocha/integration/mini_test/version_200.rb:9
1956
+ def applicable_to?(mini_test_version); end
1957
+
1958
+ # source://mocha-1.14.0/lib/mocha/integration/mini_test/version_200.rb:13
1959
+ def description; end
1960
+
1961
+ # @private
1962
+ #
1963
+ # source://mocha-1.14.0/lib/mocha/integration/mini_test/version_200.rb:17
1964
+ def included(mod); end
1965
+ end
1966
+ end
1967
+
1968
+ # source://mocha-1.14.0/lib/mocha/integration/mini_test/version_200.rb:21
1969
+ module Mocha::Integration::MiniTest::Version200::RunMethodPatch
1970
+ # source://mocha-1.14.0/lib/mocha/integration/mini_test/version_200.rb:23
1971
+ def run(runner); end
1972
+ end
1973
+
1974
+ # source://mocha-1.14.0/lib/mocha/integration/mini_test/version_201_to_222.rb:8
1975
+ module Mocha::Integration::MiniTest::Version201To222
1976
+ include ::Mocha::API
1977
+
1978
+ class << self
1979
+ # @return [Boolean]
1980
+ #
1981
+ # source://mocha-1.14.0/lib/mocha/integration/mini_test/version_201_to_222.rb:9
1982
+ def applicable_to?(mini_test_version); end
1983
+
1984
+ # source://mocha-1.14.0/lib/mocha/integration/mini_test/version_201_to_222.rb:13
1985
+ def description; end
1986
+
1987
+ # @private
1988
+ #
1989
+ # source://mocha-1.14.0/lib/mocha/integration/mini_test/version_201_to_222.rb:17
1990
+ def included(mod); end
1991
+ end
1992
+ end
1993
+
1994
+ # source://mocha-1.14.0/lib/mocha/integration/mini_test/version_201_to_222.rb:21
1995
+ module Mocha::Integration::MiniTest::Version201To222::RunMethodPatch
1996
+ # source://mocha-1.14.0/lib/mocha/integration/mini_test/version_201_to_222.rb:23
1997
+ def run(runner); end
1998
+ end
1999
+
2000
+ # source://mocha-1.14.0/lib/mocha/integration/mini_test/version_2110_to_2111.rb:8
2001
+ module Mocha::Integration::MiniTest::Version2110To2111
2002
+ include ::Mocha::API
2003
+
2004
+ class << self
2005
+ # @return [Boolean]
2006
+ #
2007
+ # source://mocha-1.14.0/lib/mocha/integration/mini_test/version_2110_to_2111.rb:9
2008
+ def applicable_to?(mini_test_version); end
2009
+
2010
+ # source://mocha-1.14.0/lib/mocha/integration/mini_test/version_2110_to_2111.rb:13
2011
+ def description; end
2012
+
2013
+ # @private
2014
+ #
2015
+ # source://mocha-1.14.0/lib/mocha/integration/mini_test/version_2110_to_2111.rb:17
2016
+ def included(mod); end
2017
+ end
2018
+ end
2019
+
2020
+ # source://mocha-1.14.0/lib/mocha/integration/mini_test/version_2110_to_2111.rb:21
2021
+ module Mocha::Integration::MiniTest::Version2110To2111::RunMethodPatch
2022
+ # source://mocha-1.14.0/lib/mocha/integration/mini_test/version_2110_to_2111.rb:23
2023
+ def run(runner); end
2024
+ end
2025
+
2026
+ # source://mocha-1.14.0/lib/mocha/integration/mini_test/version_2112_to_320.rb:8
2027
+ module Mocha::Integration::MiniTest::Version2112To320
2028
+ include ::Mocha::API
2029
+
2030
+ class << self
2031
+ # @return [Boolean]
2032
+ #
2033
+ # source://mocha-1.14.0/lib/mocha/integration/mini_test/version_2112_to_320.rb:9
2034
+ def applicable_to?(mini_test_version); end
2035
+
2036
+ # source://mocha-1.14.0/lib/mocha/integration/mini_test/version_2112_to_320.rb:13
2037
+ def description; end
2038
+
2039
+ # @private
2040
+ #
2041
+ # source://mocha-1.14.0/lib/mocha/integration/mini_test/version_2112_to_320.rb:17
2042
+ def included(mod); end
2043
+ end
2044
+ end
2045
+
2046
+ # source://mocha-1.14.0/lib/mocha/integration/mini_test/version_2112_to_320.rb:21
2047
+ module Mocha::Integration::MiniTest::Version2112To320::RunMethodPatch
2048
+ # source://mocha-1.14.0/lib/mocha/integration/mini_test/version_2112_to_320.rb:23
2049
+ def run(runner); end
2050
+ end
2051
+
2052
+ # source://mocha-1.14.0/lib/mocha/integration/mini_test/version_230_to_2101.rb:8
2053
+ module Mocha::Integration::MiniTest::Version230To2101
2054
+ include ::Mocha::API
2055
+
2056
+ class << self
2057
+ # @return [Boolean]
2058
+ #
2059
+ # source://mocha-1.14.0/lib/mocha/integration/mini_test/version_230_to_2101.rb:9
2060
+ def applicable_to?(mini_test_version); end
2061
+
2062
+ # source://mocha-1.14.0/lib/mocha/integration/mini_test/version_230_to_2101.rb:13
2063
+ def description; end
2064
+
2065
+ # @private
2066
+ #
2067
+ # source://mocha-1.14.0/lib/mocha/integration/mini_test/version_230_to_2101.rb:17
2068
+ def included(mod); end
2069
+ end
2070
+ end
2071
+
2072
+ # source://mocha-1.14.0/lib/mocha/integration/mini_test/version_230_to_2101.rb:21
2073
+ module Mocha::Integration::MiniTest::Version230To2101::RunMethodPatch
2074
+ # source://mocha-1.14.0/lib/mocha/integration/mini_test/version_230_to_2101.rb:23
2075
+ def run(runner); end
2076
+ end
2077
+
2078
+ # source://mocha-1.14.0/lib/mocha/integration/monkey_patcher.rb:5
2079
+ module Mocha::Integration::MonkeyPatcher
2080
+ class << self
2081
+ # source://mocha-1.14.0/lib/mocha/integration/monkey_patcher.rb:6
2082
+ def apply(mod, run_method_patch); end
2083
+ end
2084
+ end
2085
+
2086
+ # source://mocha-1.14.0/lib/mocha/invocation.rb:10
2087
+ class Mocha::Invocation
2088
+ # @return [Invocation] a new instance of Invocation
2089
+ #
2090
+ # source://mocha-1.14.0/lib/mocha/invocation.rb:13
2091
+ def initialize(mock, method_name, *arguments, &block); end
2092
+
2093
+ # source://mocha-1.14.0/lib/mocha/invocation.rb:53
2094
+ def arguments; end
2095
+
2096
+ # Returns the value of attribute block.
2097
+ #
2098
+ # source://mocha-1.14.0/lib/mocha/invocation.rb:11
2099
+ def block; end
2100
+
2101
+ # source://mocha-1.14.0/lib/mocha/invocation.rb:22
2102
+ def call(yield_parameters = T.unsafe(nil), return_values = T.unsafe(nil)); end
2103
+
2104
+ # source://mocha-1.14.0/lib/mocha/invocation.rb:57
2105
+ def call_description; end
2106
+
2107
+ # source://mocha-1.14.0/lib/mocha/invocation.rb:73
2108
+ def full_description; end
2109
+
2110
+ # Returns the value of attribute method_name.
2111
+ #
2112
+ # source://mocha-1.14.0/lib/mocha/invocation.rb:11
2113
+ def method_name; end
2114
+
2115
+ # source://mocha-1.14.0/lib/mocha/invocation.rb:45
2116
+ def raised(exception); end
2117
+
2118
+ # source://mocha-1.14.0/lib/mocha/invocation.rb:67
2119
+ def result_description; end
2120
+
2121
+ # source://mocha-1.14.0/lib/mocha/invocation.rb:41
2122
+ def returned(value); end
2123
+
2124
+ # source://mocha-1.14.0/lib/mocha/invocation.rb:63
2125
+ def short_call_description; end
2126
+
2127
+ # source://mocha-1.14.0/lib/mocha/invocation.rb:49
2128
+ def threw(tag, value); end
2129
+ end
2130
+
2131
+ # source://mocha-1.14.0/lib/mocha/logger.rb:2
2132
+ class Mocha::Logger
2133
+ # @return [Logger] a new instance of Logger
2134
+ #
2135
+ # source://mocha-1.14.0/lib/mocha/logger.rb:3
2136
+ def initialize(io); end
2137
+
2138
+ # source://mocha-1.14.0/lib/mocha/logger.rb:7
2139
+ def warn(message); end
2140
+ end
2141
+
2142
+ # source://mocha-1.14.0/lib/mocha/method_matcher.rb:2
2143
+ class Mocha::MethodMatcher
2144
+ # @return [MethodMatcher] a new instance of MethodMatcher
2145
+ #
2146
+ # source://mocha-1.14.0/lib/mocha/method_matcher.rb:5
2147
+ def initialize(expected_method_name); end
2148
+
2149
+ # Returns the value of attribute expected_method_name.
2150
+ #
2151
+ # source://mocha-1.14.0/lib/mocha/method_matcher.rb:3
2152
+ def expected_method_name; end
2153
+
2154
+ # @return [Boolean]
2155
+ #
2156
+ # source://mocha-1.14.0/lib/mocha/method_matcher.rb:9
2157
+ def match?(actual_method_name); end
2158
+
2159
+ # source://mocha-1.14.0/lib/mocha/method_matcher.rb:13
2160
+ def mocha_inspect; end
2161
+ end
2162
+
2163
+ # Traditional mock object.
2164
+ #
2165
+ # {expects} and {stubs} return an {Expectation} which can be further modified
2166
+ # by methods on {Expectation}.
2167
+ #
2168
+ # {responds_like} and {responds_like_instance_of} both return a {Mock}, and
2169
+ # can therefore, be chained to the original creation methods in {API}.
2170
+ # They force the mock to indicate what it is supposed to be mocking, thus
2171
+ # making it a safer verifying mock. They check that the underlying +responder+
2172
+ # will actually respond to the methods being stubbed, throwing a
2173
+ # +NoMethodError+ upon invocation otherwise.
2174
+ #
2175
+ # Stubs and expectations are basically the same thing. A stub is just an
2176
+ # expectation of zero or more invocations. The {#stubs} method is syntactic
2177
+ # sugar to make the intent of the test more explicit.
2178
+ #
2179
+ # When a method is invoked on a mock object, the mock object searches through
2180
+ # its expectations from newest to oldest to find one that matches the
2181
+ # invocation. After the invocation, the matching expectation might stop
2182
+ # matching further invocations. For example, an +expects(:foo).once+
2183
+ # expectation only matches once and will be ignored on future invocations
2184
+ # while an +expects(:foo).at_least_once+ expectation will always be matched
2185
+ # against invocations.
2186
+ #
2187
+ # This scheme allows you to:
2188
+ #
2189
+ # - Set up default stubs in your the +setup+ method of your test class and
2190
+ # override some of those stubs in individual tests.
2191
+ # - Set up different +once+ expectations for the same method with different
2192
+ # action per invocation. However, it's better to use the
2193
+ # {Expectation#returns} method with multiple arguments to do this, as
2194
+ # described below.
2195
+ #
2196
+ # However, there are some possible "gotchas" caused by this scheme:
2197
+ #
2198
+ # - if you create an expectation and then a stub for the same method, the
2199
+ # stub will always override the expectation and the expectation will never
2200
+ # be met.
2201
+ # - if you create a stub and then an expectation for the same method, the
2202
+ # expectation will match, and when it stops matching the stub will be used
2203
+ # instead, possibly masking test failures.
2204
+ # - if you create different expectations for the same method, they will be
2205
+ # invoked in the opposite order than that in which they were specified,
2206
+ # rather than the same order.
2207
+ #
2208
+ # The best thing to do is not set up multiple expectations and stubs for the
2209
+ # same method with exactly the same matchers. Instead, use the
2210
+ # {Expectation#returns} method with multiple arguments to create multiple
2211
+ # actions for a method. You can also chain multiple calls to
2212
+ # {Expectation#returns} and {Expectation#raises} (along with syntactic sugar
2213
+ # {Expectation#then} if desired).
2214
+ #
2215
+ # If you want to specify more complex ordering or order invocations across
2216
+ # different mock objects, use the {Expectation#in_sequence} method to
2217
+ # explicitly define a total or partial ordering of invocations.
2218
+ #
2219
+ # @example
2220
+ # object = mock()
2221
+ # object.stubs(:expected_method).returns(1, 2).then.raises(Exception)
2222
+ # object.expected_method # => 1
2223
+ # object.expected_method # => 2
2224
+ # object.expected_method # => raises exception of class Exception1
2225
+ #
2226
+ # source://mocha-1.14.0/lib/mocha/mock.rb:76
2227
+ class Mocha::Mock
2228
+ # @private
2229
+ # @return [Mock] a new instance of Mock
2230
+ #
2231
+ # source://mocha-1.14.0/lib/mocha/mock.rb:274
2232
+ def initialize(mockery, name = T.unsafe(nil), receiver = T.unsafe(nil)); end
2233
+
2234
+ # @private
2235
+ #
2236
+ # source://mocha-1.14.0/lib/mocha/mock.rb:298
2237
+ def __expectations__; end
2238
+
2239
+ # Adds an expectation that the specified method must be called exactly once with any parameters.
2240
+ #
2241
+ # @example Expected method invoked once so no error raised
2242
+ # object = mock()
2243
+ # object.expects(:expected_method)
2244
+ # object.expected_method
2245
+ # @example Expected method not invoked so error raised
2246
+ # object = mock()
2247
+ # object.expects(:expected_method)
2248
+ # # error raised when test completes, because expected_method not called exactly once
2249
+ # @example Expected method invoked twice so error raised
2250
+ # object = mock()
2251
+ # object.expects(:expected_method)
2252
+ # object.expected_method
2253
+ # object.expected_method # => error raised when expected method invoked second time
2254
+ # @example Setup multiple expectations using +expected_methods_vs_return_values+.
2255
+ # object = mock()
2256
+ # object.expects(:expected_method_one => :result_one, :expected_method_two => :result_two)
2257
+ #
2258
+ # # is exactly equivalent to
2259
+ #
2260
+ # object = mock()
2261
+ # object.expects(:expected_method_one).returns(:result_one)
2262
+ # object.expects(:expected_method_two).returns(:result_two)
2263
+ # @overload expects
2264
+ # @overload expects
2265
+ # @return [Expectation] last-built expectation which can be further modified by methods on {Expectation}.
2266
+ #
2267
+ # source://mocha-1.14.0/lib/mocha/mock.rb:111
2268
+ def __expects__(method_name_or_hash, backtrace = T.unsafe(nil)); end
2269
+
2270
+ # @private
2271
+ #
2272
+ # source://mocha-1.14.0/lib/mocha/mock.rb:350
2273
+ def __expire__; end
2274
+
2275
+ def __singleton_class__; end
2276
+
2277
+ # Adds an expectation that the specified method may be called any number of times with any parameters.
2278
+ #
2279
+ # @example No error raised however many times stubbed method is invoked
2280
+ # object = mock()
2281
+ # object.stubs(:stubbed_method)
2282
+ # object.stubbed_method
2283
+ # object.stubbed_method
2284
+ # # no error raised
2285
+ # @example Setup multiple expectations using +stubbed_methods_vs_return_values+.
2286
+ # object = mock()
2287
+ # object.stubs(:stubbed_method_one => :result_one, :stubbed_method_two => :result_two)
2288
+ #
2289
+ # # is exactly equivalent to
2290
+ #
2291
+ # object = mock()
2292
+ # object.stubs(:stubbed_method_one).returns(:result_one)
2293
+ # object.stubs(:stubbed_method_two).returns(:result_two)
2294
+ # @overload stubs
2295
+ # @overload stubs
2296
+ # @return [Expectation] last-built expectation which can be further modified by methods on {Expectation}.
2297
+ #
2298
+ # source://mocha-1.14.0/lib/mocha/mock.rb:149
2299
+ def __stubs__(method_name_or_hash, backtrace = T.unsafe(nil)); end
2300
+
2301
+ # @private
2302
+ # @return [Boolean]
2303
+ #
2304
+ # source://mocha-1.14.0/lib/mocha/mock.rb:345
2305
+ def __verified__?(assertion_counter = T.unsafe(nil)); end
2306
+
2307
+ # @private
2308
+ #
2309
+ # source://mocha-1.14.0/lib/mocha/mock.rb:308
2310
+ def all_expectations; end
2311
+
2312
+ # @private
2313
+ # @return [Boolean]
2314
+ #
2315
+ # source://mocha-1.14.0/lib/mocha/mock.rb:370
2316
+ def any_expectations?; end
2317
+
2318
+ # @private
2319
+ #
2320
+ # source://mocha-1.14.0/lib/mocha/mock.rb:365
2321
+ def ensure_method_not_already_defined(method_name); end
2322
+
2323
+ # @private
2324
+ #
2325
+ # source://mocha-1.14.0/lib/mocha/mock.rb:286
2326
+ def everything_stubbed; end
2327
+
2328
+ # Adds an expectation that the specified method must be called exactly once with any parameters.
2329
+ #
2330
+ # @example Expected method invoked once so no error raised
2331
+ # object = mock()
2332
+ # object.expects(:expected_method)
2333
+ # object.expected_method
2334
+ # @example Expected method not invoked so error raised
2335
+ # object = mock()
2336
+ # object.expects(:expected_method)
2337
+ # # error raised when test completes, because expected_method not called exactly once
2338
+ # @example Expected method invoked twice so error raised
2339
+ # object = mock()
2340
+ # object.expects(:expected_method)
2341
+ # object.expected_method
2342
+ # object.expected_method # => error raised when expected method invoked second time
2343
+ # @example Setup multiple expectations using +expected_methods_vs_return_values+.
2344
+ # object = mock()
2345
+ # object.expects(:expected_method_one => :result_one, :expected_method_two => :result_two)
2346
+ #
2347
+ # # is exactly equivalent to
2348
+ #
2349
+ # object = mock()
2350
+ # object.expects(:expected_method_one).returns(:result_one)
2351
+ # object.expects(:expected_method_two).returns(:result_two)
2352
+ # @overload expects
2353
+ # @overload expects
2354
+ # @return [Expectation] last-built expectation which can be further modified by methods on {Expectation}.
2355
+ #
2356
+ # source://mocha-1.14.0/lib/mocha/mock.rb:111
2357
+ def expects(method_name_or_hash, backtrace = T.unsafe(nil)); end
2358
+
2359
+ # @private
2360
+ #
2361
+ # source://mocha-1.14.0/lib/mocha/mock.rb:360
2362
+ def inspect; end
2363
+
2364
+ # @private
2365
+ #
2366
+ # source://mocha-1.14.0/lib/mocha/mock.rb:313
2367
+ def method_missing(symbol, *arguments, &block); end
2368
+
2369
+ # @private
2370
+ #
2371
+ # source://mocha-1.14.0/lib/mocha/mock.rb:355
2372
+ def mocha_inspect; end
2373
+
2374
+ # Constrains the {Mock} instance so that it can only expect or stub methods to which +responder+ responds. The constraint is only applied at method invocation time.
2375
+ #
2376
+ # A +NoMethodError+ will be raised if the +responder+ does not +#respond_to?+ a method invocation (even if the method has been expected or stubbed).
2377
+ #
2378
+ # The {Mock} instance will delegate its +#respond_to?+ method to the +responder+.
2379
+ #
2380
+ # Note that the methods on +responder+ are never actually invoked.
2381
+ #
2382
+ # @example Normal mocking
2383
+ # sheep = mock('sheep')
2384
+ # sheep.expects(:chew)
2385
+ # sheep.expects(:foo)
2386
+ # sheep.respond_to?(:chew) # => true
2387
+ # sheep.respond_to?(:foo) # => true
2388
+ # sheep.chew
2389
+ # sheep.foo
2390
+ # # no error raised
2391
+ # @example Using {#responds_like} with an instance method
2392
+ # class Sheep
2393
+ # def chew(grass); end
2394
+ # end
2395
+ #
2396
+ # sheep = mock('sheep')
2397
+ # sheep.responds_like(Sheep.new)
2398
+ # sheep.expects(:chew)
2399
+ # sheep.expects(:foo)
2400
+ # sheep.respond_to?(:chew) # => true
2401
+ # sheep.respond_to?(:foo) # => false
2402
+ # sheep.chew
2403
+ # sheep.foo # => raises NoMethodError exception
2404
+ # @example Using {#responds_like} with a class method
2405
+ # class Sheep
2406
+ # def self.number_of_legs; end
2407
+ # end
2408
+ #
2409
+ # sheep_class = mock('sheep_class')
2410
+ # sheep_class.responds_like(Sheep)
2411
+ # sheep_class.stubs(:number_of_legs).returns(4)
2412
+ # sheep_class.expects(:foo)
2413
+ # sheep_class.respond_to?(:number_of_legs) # => true
2414
+ # sheep_class.respond_to?(:foo) # => false
2415
+ # sheep_class.number_of_legs # => 4
2416
+ # sheep_class.foo # => raises NoMethodError exception
2417
+ # @param responder [Object, #respond_to?] an object used to determine whether {Mock} instance should +#respond_to?+ to an invocation.
2418
+ # @return [Mock] the same {Mock} instance, thereby allowing invocations of other {Mock} methods to be chained.
2419
+ # @see #responds_like_instance_of
2420
+ #
2421
+ # source://mocha-1.14.0/lib/mocha/mock.rb:236
2422
+ def quacks_like(responder); end
2423
+
2424
+ # Constrains the {Mock} instance so that it can only expect or stub methods to which an instance of the +responder_class+ responds. The constraint is only applied at method invocation time. Note that the responder instance is instantiated using +Class#allocate+.
2425
+ #
2426
+ # A +NoMethodError+ will be raised if the responder instance does not +#respond_to?+ a method invocation (even if the method has been expected or stubbed).
2427
+ #
2428
+ # The {Mock} instance will delegate its +#respond_to?+ method to the responder instance.
2429
+ #
2430
+ # Note that the methods on the responder instance are never actually invoked.
2431
+ #
2432
+ # @example Using {#responds_like_instance_of}
2433
+ # class Sheep
2434
+ # def initialize
2435
+ # raise "some awkward code we don't want to call"
2436
+ # end
2437
+ # def chew(grass); end
2438
+ # end
2439
+ #
2440
+ # sheep = mock('sheep')
2441
+ # sheep.responds_like_instance_of(Sheep)
2442
+ # sheep.expects(:chew)
2443
+ # sheep.expects(:foo)
2444
+ # sheep.respond_to?(:chew) # => true
2445
+ # sheep.respond_to?(:foo) # => false
2446
+ # sheep.chew
2447
+ # sheep.foo # => raises NoMethodError exception
2448
+ # @param responder_class [Class] a class used to determine whether {Mock} instance should +#respond_to?+ to an invocation.
2449
+ # @return [Mock] the same {Mock} instance, thereby allowing invocations of other {Mock} methods to be chained.
2450
+ # @see #responds_like
2451
+ #
2452
+ # source://mocha-1.14.0/lib/mocha/mock.rb:269
2453
+ def quacks_like_instance_of(responder_class); end
2454
+
2455
+ # Constrains the {Mock} instance so that it can only expect or stub methods to which +responder+ responds. The constraint is only applied at method invocation time.
2456
+ #
2457
+ # A +NoMethodError+ will be raised if the +responder+ does not +#respond_to?+ a method invocation (even if the method has been expected or stubbed).
2458
+ #
2459
+ # The {Mock} instance will delegate its +#respond_to?+ method to the +responder+.
2460
+ #
2461
+ # Note that the methods on +responder+ are never actually invoked.
2462
+ #
2463
+ # @example Normal mocking
2464
+ # sheep = mock('sheep')
2465
+ # sheep.expects(:chew)
2466
+ # sheep.expects(:foo)
2467
+ # sheep.respond_to?(:chew) # => true
2468
+ # sheep.respond_to?(:foo) # => true
2469
+ # sheep.chew
2470
+ # sheep.foo
2471
+ # # no error raised
2472
+ # @example Using {#responds_like} with an instance method
2473
+ # class Sheep
2474
+ # def chew(grass); end
2475
+ # end
2476
+ #
2477
+ # sheep = mock('sheep')
2478
+ # sheep.responds_like(Sheep.new)
2479
+ # sheep.expects(:chew)
2480
+ # sheep.expects(:foo)
2481
+ # sheep.respond_to?(:chew) # => true
2482
+ # sheep.respond_to?(:foo) # => false
2483
+ # sheep.chew
2484
+ # sheep.foo # => raises NoMethodError exception
2485
+ # @example Using {#responds_like} with a class method
2486
+ # class Sheep
2487
+ # def self.number_of_legs; end
2488
+ # end
2489
+ #
2490
+ # sheep_class = mock('sheep_class')
2491
+ # sheep_class.responds_like(Sheep)
2492
+ # sheep_class.stubs(:number_of_legs).returns(4)
2493
+ # sheep_class.expects(:foo)
2494
+ # sheep_class.respond_to?(:number_of_legs) # => true
2495
+ # sheep_class.respond_to?(:foo) # => false
2496
+ # sheep_class.number_of_legs # => 4
2497
+ # sheep_class.foo # => raises NoMethodError exception
2498
+ # @param responder [Object, #respond_to?] an object used to determine whether {Mock} instance should +#respond_to?+ to an invocation.
2499
+ # @return [Mock] the same {Mock} instance, thereby allowing invocations of other {Mock} methods to be chained.
2500
+ # @see #responds_like_instance_of
2501
+ #
2502
+ # source://mocha-1.14.0/lib/mocha/mock.rb:236
2503
+ def responds_like(responder); end
2504
+
2505
+ # Constrains the {Mock} instance so that it can only expect or stub methods to which an instance of the +responder_class+ responds. The constraint is only applied at method invocation time. Note that the responder instance is instantiated using +Class#allocate+.
2506
+ #
2507
+ # A +NoMethodError+ will be raised if the responder instance does not +#respond_to?+ a method invocation (even if the method has been expected or stubbed).
2508
+ #
2509
+ # The {Mock} instance will delegate its +#respond_to?+ method to the responder instance.
2510
+ #
2511
+ # Note that the methods on the responder instance are never actually invoked.
2512
+ #
2513
+ # @example Using {#responds_like_instance_of}
2514
+ # class Sheep
2515
+ # def initialize
2516
+ # raise "some awkward code we don't want to call"
2517
+ # end
2518
+ # def chew(grass); end
2519
+ # end
2520
+ #
2521
+ # sheep = mock('sheep')
2522
+ # sheep.responds_like_instance_of(Sheep)
2523
+ # sheep.expects(:chew)
2524
+ # sheep.expects(:foo)
2525
+ # sheep.respond_to?(:chew) # => true
2526
+ # sheep.respond_to?(:foo) # => false
2527
+ # sheep.chew
2528
+ # sheep.foo # => raises NoMethodError exception
2529
+ # @param responder_class [Class] a class used to determine whether {Mock} instance should +#respond_to?+ to an invocation.
2530
+ # @return [Mock] the same {Mock} instance, thereby allowing invocations of other {Mock} methods to be chained.
2531
+ # @see #responds_like
2532
+ #
2533
+ # source://mocha-1.14.0/lib/mocha/mock.rb:269
2534
+ def responds_like_instance_of(responder_class); end
2535
+
2536
+ # @private
2537
+ #
2538
+ # source://mocha-1.14.0/lib/mocha/mock.rb:303
2539
+ def stub_everything; end
2540
+
2541
+ # Adds an expectation that the specified method may be called any number of times with any parameters.
2542
+ #
2543
+ # @example No error raised however many times stubbed method is invoked
2544
+ # object = mock()
2545
+ # object.stubs(:stubbed_method)
2546
+ # object.stubbed_method
2547
+ # object.stubbed_method
2548
+ # # no error raised
2549
+ # @example Setup multiple expectations using +stubbed_methods_vs_return_values+.
2550
+ # object = mock()
2551
+ # object.stubs(:stubbed_method_one => :result_one, :stubbed_method_two => :result_two)
2552
+ #
2553
+ # # is exactly equivalent to
2554
+ #
2555
+ # object = mock()
2556
+ # object.stubs(:stubbed_method_one).returns(:result_one)
2557
+ # object.stubs(:stubbed_method_two).returns(:result_two)
2558
+ # @overload stubs
2559
+ # @overload stubs
2560
+ # @return [Expectation] last-built expectation which can be further modified by methods on {Expectation}.
2561
+ #
2562
+ # source://mocha-1.14.0/lib/mocha/mock.rb:149
2563
+ def stubs(method_name_or_hash, backtrace = T.unsafe(nil)); end
2564
+
2565
+ # Removes the specified stubbed methods (added by calls to {#expects} or {#stubs}) and all expectations associated with them.
2566
+ #
2567
+ # @example Invoking an unstubbed method causes error to be raised
2568
+ # object = mock('mock') do
2569
+ # object.stubs(:stubbed_method).returns(:result_one)
2570
+ # object.stubbed_method # => :result_one
2571
+ # object.unstub(:stubbed_method)
2572
+ # object.stubbed_method # => unexpected invocation: #<Mock:mock>.stubbed_method()
2573
+ # @example Unstubbing multiple methods.
2574
+ # multiplier.unstub(:double, :triple)
2575
+ #
2576
+ # # exactly equivalent to
2577
+ #
2578
+ # multiplier.unstub(:double)
2579
+ # multiplier.unstub(:triple)
2580
+ # @param method_names [Array<Symbol>] names of methods to unstub.
2581
+ #
2582
+ # source://mocha-1.14.0/lib/mocha/mock.rb:181
2583
+ def unstub(*method_names); end
2584
+
2585
+ private
2586
+
2587
+ # source://mocha-1.14.0/lib/mocha/mock.rb:393
2588
+ def check_expiry; end
2589
+
2590
+ # source://mocha-1.14.0/lib/mocha/mock.rb:387
2591
+ def check_responder_responds_to(symbol); end
2592
+
2593
+ # source://mocha-1.14.0/lib/mocha/mock.rb:376
2594
+ def raise_unexpected_invocation_error(invocation, matching_expectation); end
2595
+
2596
+ # @private
2597
+ # @return [Boolean]
2598
+ #
2599
+ # source://mocha-1.14.0/lib/mocha/mock.rb:325
2600
+ def respond_to_missing?(symbol, include_private = T.unsafe(nil)); end
2601
+ end
2602
+
2603
+ # source://mocha-1.14.0/lib/mocha/mockery.rb:14
2604
+ class Mocha::Mockery
2605
+ # source://mocha-1.14.0/lib/mocha/mockery.rb:136
2606
+ def logger; end
2607
+
2608
+ # Sets the attribute logger
2609
+ #
2610
+ # @param value the value to set the attribute logger to.
2611
+ #
2612
+ # source://mocha-1.14.0/lib/mocha/mockery.rb:134
2613
+ def logger=(_arg0); end
2614
+
2615
+ # source://mocha-1.14.0/lib/mocha/mockery.rb:113
2616
+ def mocha_inspect; end
2617
+
2618
+ # source://mocha-1.14.0/lib/mocha/mockery.rb:67
2619
+ def mock_impersonating(object); end
2620
+
2621
+ # source://mocha-1.14.0/lib/mocha/mockery.rb:71
2622
+ def mock_impersonating_any_instance_of(klass); end
2623
+
2624
+ # source://mocha-1.14.0/lib/mocha/mockery.rb:105
2625
+ def mocks; end
2626
+
2627
+ # source://mocha-1.14.0/lib/mocha/mockery.rb:59
2628
+ def named_mock(name); end
2629
+
2630
+ # source://mocha-1.14.0/lib/mocha/mockery.rb:75
2631
+ def new_state_machine(name); end
2632
+
2633
+ # source://mocha-1.14.0/lib/mocha/mockery.rb:121
2634
+ def on_stubbing(object, method); end
2635
+
2636
+ # source://mocha-1.14.0/lib/mocha/mockery.rb:109
2637
+ def state_machines; end
2638
+
2639
+ # source://mocha-1.14.0/lib/mocha/mockery.rb:101
2640
+ def stubba; end
2641
+
2642
+ # source://mocha-1.14.0/lib/mocha/mockery.rb:95
2643
+ def teardown; end
2644
+
2645
+ # source://mocha-1.14.0/lib/mocha/mockery.rb:63
2646
+ def unnamed_mock; end
2647
+
2648
+ # source://mocha-1.14.0/lib/mocha/mockery.rb:79
2649
+ def verify(assertion_counter = T.unsafe(nil)); end
2650
+
2651
+ private
2652
+
2653
+ # source://mocha-1.14.0/lib/mocha/mockery.rb:163
2654
+ def add_mock(mock); end
2655
+
2656
+ # source://mocha-1.14.0/lib/mocha/mockery.rb:168
2657
+ def add_state_machine(state_machine); end
2658
+
2659
+ # @raise [StubbingError]
2660
+ #
2661
+ # source://mocha-1.14.0/lib/mocha/mockery.rb:142
2662
+ def check(action, description, signature_proc, backtrace = T.unsafe(nil)); end
2663
+
2664
+ # source://mocha-1.14.0/lib/mocha/mockery.rb:151
2665
+ def expectations; end
2666
+
2667
+ # source://mocha-1.14.0/lib/mocha/mockery.rb:173
2668
+ def reset; end
2669
+
2670
+ # source://mocha-1.14.0/lib/mocha/mockery.rb:159
2671
+ def satisfied_expectations; end
2672
+
2673
+ # source://mocha-1.14.0/lib/mocha/mockery.rb:155
2674
+ def unsatisfied_expectations; end
2675
+
2676
+ class << self
2677
+ # source://mocha-1.14.0/lib/mocha/mockery.rb:37
2678
+ def instance; end
2679
+
2680
+ # source://mocha-1.14.0/lib/mocha/mockery.rb:41
2681
+ def setup; end
2682
+
2683
+ # source://mocha-1.14.0/lib/mocha/mockery.rb:52
2684
+ def teardown; end
2685
+
2686
+ # source://mocha-1.14.0/lib/mocha/mockery.rb:48
2687
+ def verify(*args); end
2688
+ end
2689
+ end
2690
+
2691
+ # source://mocha-1.14.0/lib/mocha/mockery.rb:15
2692
+ class Mocha::Mockery::Null < ::Mocha::Mockery
2693
+ # source://mocha-1.14.0/lib/mocha/mockery.rb:16
2694
+ def add_mock(*_arg0); end
2695
+
2696
+ # source://mocha-1.14.0/lib/mocha/mockery.rb:20
2697
+ def add_state_machine(*_arg0); end
2698
+
2699
+ # source://mocha-1.14.0/lib/mocha/mockery.rb:24
2700
+ def stubba; end
2701
+
2702
+ private
2703
+
2704
+ # @raise [NotInitializedError]
2705
+ #
2706
+ # source://mocha-1.14.0/lib/mocha/mockery.rb:30
2707
+ def raise_not_initialized_error; end
2708
+ end
2709
+
2710
+ # source://mocha-1.14.0/lib/mocha/names.rb:22
2711
+ class Mocha::Name
2712
+ # @return [Name] a new instance of Name
2713
+ #
2714
+ # source://mocha-1.14.0/lib/mocha/names.rb:23
2715
+ def initialize(name); end
2716
+
2717
+ # source://mocha-1.14.0/lib/mocha/names.rb:27
2718
+ def mocha_inspect; end
2719
+ end
2720
+
2721
+ # Exception raised when Mocha has not been initialized, e.g. outside the
2722
+ # context of a test.
2723
+ #
2724
+ # source://mocha-1.14.0/lib/mocha/not_initialized_error.rb:6
2725
+ class Mocha::NotInitializedError < ::Mocha::ErrorWithFilteredBacktrace; end
2726
+
2727
+ # Methods added to all objects to allow mocking and stubbing on real (i.e. non-mock) objects.
2728
+ #
2729
+ # Both {#expects} and {#stubs} return an {Expectation} which can be further modified by methods on {Expectation}.
2730
+ #
2731
+ # source://mocha-1.14.0/lib/mocha/object_methods.rb:10
2732
+ module Mocha::ObjectMethods
2733
+ # @private
2734
+ def _method(_arg0); end
2735
+
2736
+ # Adds an expectation that the specified method must be called exactly once with any parameters.
2737
+ #
2738
+ # The original implementation of the method is replaced during the test and then restored at the end of the test. The temporary replacement method has the same visibility as the original method.
2739
+ #
2740
+ # @example Setting up an expectation on a non-mock object.
2741
+ # product = Product.new
2742
+ # product.expects(:save).returns(true)
2743
+ # assert_equal true, product.save
2744
+ # @example Setting up multiple expectations on a non-mock object.
2745
+ # product = Product.new
2746
+ # product.expects(:valid? => true, :save => true)
2747
+ #
2748
+ # # exactly equivalent to
2749
+ #
2750
+ # product = Product.new
2751
+ # product.expects(:valid?).returns(true)
2752
+ # product.expects(:save).returns(true)
2753
+ # @overload expects
2754
+ # @overload expects
2755
+ # @raise [StubbingError] if attempting to stub method which is not allowed.
2756
+ # @return [Expectation] last-built expectation which can be further modified by methods on {Expectation}.
2757
+ # @see Mock#expects
2758
+ #
2759
+ # source://mocha-1.14.0/lib/mocha/object_methods.rb:71
2760
+ def expects(expected_methods_vs_return_values); end
2761
+
2762
+ # @private
2763
+ #
2764
+ # source://mocha-1.14.0/lib/mocha/object_methods.rb:15
2765
+ def mocha(instantiate = T.unsafe(nil)); end
2766
+
2767
+ # @private
2768
+ #
2769
+ # source://mocha-1.14.0/lib/mocha/object_methods.rb:24
2770
+ def reset_mocha; end
2771
+
2772
+ # @private
2773
+ #
2774
+ # source://mocha-1.14.0/lib/mocha/object_methods.rb:39
2775
+ def stubba_class; end
2776
+
2777
+ # @private
2778
+ #
2779
+ # source://mocha-1.14.0/lib/mocha/object_methods.rb:29
2780
+ def stubba_method; end
2781
+
2782
+ # @private
2783
+ #
2784
+ # source://mocha-1.14.0/lib/mocha/object_methods.rb:34
2785
+ def stubba_object; end
2786
+
2787
+ # Adds an expectation that the specified method may be called any number of times with any parameters.
2788
+ #
2789
+ # The original implementation of the method is replaced during the test and then restored at the end of the test. The temporary replacement method has the same visibility as the original method.
2790
+ #
2791
+ # @example Setting up a stubbed methods on a non-mock object.
2792
+ # product = Product.new
2793
+ # product.stubs(:save).returns(true)
2794
+ # assert_equal true, product.save
2795
+ # @example Setting up multiple stubbed methods on a non-mock object.
2796
+ # product = Product.new
2797
+ # product.stubs(:valid? => true, :save => true)
2798
+ #
2799
+ # # exactly equivalent to
2800
+ #
2801
+ # product = Product.new
2802
+ # product.stubs(:valid?).returns(true)
2803
+ # product.stubs(:save).returns(true)
2804
+ # @overload stubs
2805
+ # @overload stubs
2806
+ # @raise [StubbingError] if attempting to stub method which is not allowed.
2807
+ # @return [Expectation] last-built expectation which can be further modified by methods on {Expectation}.
2808
+ # @see Mock#stubs
2809
+ #
2810
+ # source://mocha-1.14.0/lib/mocha/object_methods.rb:120
2811
+ def stubs(stubbed_methods_vs_return_values); end
2812
+
2813
+ # Removes the specified stubbed methods (added by calls to {#expects} or {#stubs}) and all expectations associated with them.
2814
+ #
2815
+ # Restores the original behaviour of the methods before they were stubbed. This is normally done automatically at the end of each test, but in some circumstances you may want to do it *before* the end of the test.
2816
+ #
2817
+ # WARNING: If you {#unstub} a method which still has unsatisfied expectations, you may be removing the only way those expectations can be satisfied. Use {#unstub} with care.
2818
+ #
2819
+ # @example Stubbing and unstubbing a method on a real (non-mock) object.
2820
+ # multiplier = Multiplier.new
2821
+ # multiplier.double(2) # => 4
2822
+ # multiplier.stubs(:double).raises # new behaviour defined
2823
+ # multiplier.double(2) # => raises exception
2824
+ # multiplier.unstub(:double) # original behaviour restored
2825
+ # multiplier.double(2) # => 4
2826
+ # @example Unstubbing multiple methods on a real (non-mock) object.
2827
+ # multiplier.unstub(:double, :triple)
2828
+ #
2829
+ # # exactly equivalent to
2830
+ #
2831
+ # multiplier.unstub(:double)
2832
+ # multiplier.unstub(:triple)
2833
+ # @param method_names [Array<Symbol>] names of methods to unstub.
2834
+ #
2835
+ # source://mocha-1.14.0/lib/mocha/object_methods.rb:161
2836
+ def unstub(*method_names); end
2837
+ end
2838
+
2839
+ # source://mocha-1.14.0/lib/mocha/receivers.rb:2
2840
+ class Mocha::ObjectReceiver
2841
+ # @return [ObjectReceiver] a new instance of ObjectReceiver
2842
+ #
2843
+ # source://mocha-1.14.0/lib/mocha/receivers.rb:3
2844
+ def initialize(object); end
2845
+
2846
+ # source://mocha-1.14.0/lib/mocha/receivers.rb:7
2847
+ def mocks; end
2848
+ end
2849
+
2850
+ # Used as parameters for {Expectation#with} to restrict the parameter values which will match the expectation. Can be nested.
2851
+ #
2852
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers.rb:3
2853
+ module Mocha::ParameterMatchers
2854
+ # Matches if +matcher+ does *not* match.
2855
+ #
2856
+ # @example Actual parameter does not include the value +1+.
2857
+ # object = mock()
2858
+ # object.expects(:method_1).with(Not(includes(1)))
2859
+ # object.method_1([0, 2, 3])
2860
+ # # no error raised
2861
+ # @example Actual parameter does include the value +1+.
2862
+ # object = mock()
2863
+ # object.expects(:method_1).with(Not(includes(1)))
2864
+ # object.method_1([0, 1, 2, 3])
2865
+ # # error raised, because method_1 was not called with object not including 1
2866
+ # @param matcher [Base] matcher whose logic to invert.
2867
+ # @return [Not] parameter matcher.
2868
+ # @see Expectation#with
2869
+ #
2870
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/not.rb:24
2871
+ def Not(matcher); end
2872
+
2873
+ # Matches if all +matchers+ match.
2874
+ #
2875
+ # @example All parameter matchers match.
2876
+ # object = mock()
2877
+ # object.expects(:method_1).with(all_of(includes(1), includes(3)))
2878
+ # object.method_1([1, 3])
2879
+ # # no error raised
2880
+ # @example One of the parameter matchers does not match.
2881
+ # object = mock()
2882
+ # object.expects(:method_1).with(all_of(includes(1), includes(3)))
2883
+ # object.method_1([1, 2])
2884
+ # # error raised, because method_1 was not called with object including 1 and 3
2885
+ # @param matchers [*Array<Base>] parameter matchers.
2886
+ # @return [AllOf] parameter matcher.
2887
+ # @see Expectation#with
2888
+ #
2889
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/all_of.rb:23
2890
+ def all_of(*matchers); end
2891
+
2892
+ # Matches if any +matchers+ match.
2893
+ #
2894
+ # @example One parameter matcher matches.
2895
+ # object = mock()
2896
+ # object.expects(:method_1).with(any_of(1, 3))
2897
+ # object.method_1(1)
2898
+ # # no error raised
2899
+ # @example The other parameter matcher matches.
2900
+ # object = mock()
2901
+ # object.expects(:method_1).with(any_of(1, 3))
2902
+ # object.method_1(3)
2903
+ # # no error raised
2904
+ # @example Neither parameter matcher matches.
2905
+ # object = mock()
2906
+ # object.expects(:method_1).with(any_of(1, 3))
2907
+ # object.method_1(2)
2908
+ # # error raised, because method_1 was not called with 1 or 3
2909
+ # @param matchers [*Array<Base>] parameter matchers.
2910
+ # @return [AnyOf] parameter matcher.
2911
+ # @see Expectation#with
2912
+ #
2913
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/any_of.rb:29
2914
+ def any_of(*matchers); end
2915
+
2916
+ # Matches any parameters. This is used as the default for a newly built expectation.
2917
+ #
2918
+ # @example Any parameters will match.
2919
+ # object = mock()
2920
+ # object.expects(:method_1).with(any_parameters)
2921
+ # object.method_1(1, 2, 3, 4)
2922
+ # # no error raised
2923
+ #
2924
+ # object = mock()
2925
+ # object.expects(:method_1).with(any_parameters)
2926
+ # object.method_1(5, 6, 7, 8, 9, 0)
2927
+ # # no error raised
2928
+ # @return [AnyParameters] parameter matcher.
2929
+ # @see Expectation#with
2930
+ #
2931
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/any_parameters.rb:21
2932
+ def any_parameters; end
2933
+
2934
+ # Matches any object.
2935
+ #
2936
+ # @example Any object will match.
2937
+ # object = mock()
2938
+ # object.expects(:method_1).with(anything)
2939
+ # object.method_1('foo')
2940
+ # object.method_1(789)
2941
+ # object.method_1(:bar)
2942
+ # # no error raised
2943
+ # @return [Anything] parameter matcher.
2944
+ # @see Expectation#with
2945
+ #
2946
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/anything.rb:18
2947
+ def anything; end
2948
+
2949
+ # Matches any +Object+ equalling +value+.
2950
+ #
2951
+ # @example Actual parameter equals expected parameter.
2952
+ # object = mock()
2953
+ # object.expects(:method_1).with(equals(2))
2954
+ # object.method_1(2)
2955
+ # # no error raised
2956
+ # @example Actual parameter does not equal expected parameter.
2957
+ # object = mock()
2958
+ # object.expects(:method_1).with(equals(2))
2959
+ # object.method_1(3)
2960
+ # # error raised, because method_1 was not called with an +Object+ that equals 2
2961
+ # @param value [Object] expected value.
2962
+ # @return [Equals] parameter matcher.
2963
+ # @see Expectation#with
2964
+ # @see Object#==
2965
+ #
2966
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/equals.rb:24
2967
+ def equals(value); end
2968
+
2969
+ # Matches a URI without regard to the ordering of parameters in the query string.
2970
+ #
2971
+ # @example Actual URI is equivalent.
2972
+ # object = mock()
2973
+ # object.expects(:method_1).with(equivalent_uri('http://example.com/foo?a=1&b=2))
2974
+ # object.method_1('http://example.com/foo?b=2&a=1')
2975
+ # # no error raised
2976
+ # @example Actual URI is not equivalent.
2977
+ # object = mock()
2978
+ # object.expects(:method_1).with(equivalent_uri('http://example.com/foo?a=1&b=2))
2979
+ # object.method_1('http://example.com/foo?a=1&b=3')
2980
+ # # error raised, because the query parameters were different
2981
+ # @param uri [String] URI to match.
2982
+ # @return [EquivalentUri] parameter matcher.
2983
+ # @see Expectation#with
2984
+ #
2985
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/equivalent_uri.rb:26
2986
+ def equivalent_uri(uri); end
2987
+
2988
+ # Matches +Hash+ containing all +entries+.
2989
+ #
2990
+ # @example Actual parameter contains all expected entries.
2991
+ # object = mock()
2992
+ # object.expects(:method_1).with(has_entries('key_1' => 1, 'key_2' => 2))
2993
+ # object.method_1('key_1' => 1, 'key_2' => 2, 'key_3' => 3)
2994
+ # # no error raised
2995
+ # @example Actual parameter does not contain all expected entries.
2996
+ # object = mock()
2997
+ # object.expects(:method_1).with(has_entries('key_1' => 1, 'key_2' => 2))
2998
+ # object.method_1('key_1' => 1, 'key_2' => 99)
2999
+ # # error raised, because method_1 was not called with Hash containing entries: 'key_1' => 1, 'key_2' => 2
3000
+ # @param entries [Hash] expected +Hash+ entries.
3001
+ # @return [HasEntries] parameter matcher.
3002
+ # @see Expectation#with
3003
+ #
3004
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/has_entries.rb:26
3005
+ def has_entries(entries); end
3006
+
3007
+ # Matches +Hash+ containing entry with +key+ and +value+.
3008
+ #
3009
+ # @example Actual parameter contains expected entry supplied as key and value.
3010
+ # object = mock()
3011
+ # object.expects(:method_1).with(has_entry('key_1', 1))
3012
+ # object.method_1('key_1' => 1, 'key_2' => 2)
3013
+ # # no error raised
3014
+ # @example Actual parameter contains expected entry supplied as +Hash+ entry.
3015
+ # object = mock()
3016
+ # object.expects(:method_1).with(has_entry('key_1' => 1))
3017
+ # object.method_1('key_1' => 1, 'key_2' => 2)
3018
+ # # no error raised
3019
+ # @example Actual parameter does not contain expected entry supplied as key and value.
3020
+ # object = mock()
3021
+ # object.expects(:method_1).with(has_entry('key_1', 1))
3022
+ # object.method_1('key_1' => 2, 'key_2' => 1)
3023
+ # # error raised, because method_1 was not called with Hash containing entry: 'key_1' => 1
3024
+ # @example Actual parameter does not contain expected entry supplied as +Hash+ entry.
3025
+ #
3026
+ # object = mock()
3027
+ # object.expects(:method_1).with(has_entry('key_1' => 1))
3028
+ # object.method_1('key_1' => 2, 'key_2' => 1)
3029
+ # # error raised, because method_1 was not called with Hash containing entry: 'key_1' => 1
3030
+ # @overload has_entry
3031
+ # @overload has_entry
3032
+ # @return [HasEntry] parameter matcher.
3033
+ # @see Expectation#with
3034
+ #
3035
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/has_entry.rb:43
3036
+ def has_entry(*options); end
3037
+
3038
+ # Matches +Hash+ containing +key+.
3039
+ #
3040
+ # @example Actual parameter contains entry with expected key.
3041
+ # object = mock()
3042
+ # object.expects(:method_1).with(has_key('key_1'))
3043
+ # object.method_1('key_1' => 1, 'key_2' => 2)
3044
+ # # no error raised
3045
+ # @example Actual parameter does not contain entry with expected key.
3046
+ # object = mock()
3047
+ # object.expects(:method_1).with(has_key('key_1'))
3048
+ # object.method_1('key_2' => 2)
3049
+ # # error raised, because method_1 was not called with Hash containing key: 'key_1'
3050
+ # @param key [Object] expected key.
3051
+ # @return [HasKey] parameter matcher.
3052
+ # @see Expectation#with
3053
+ #
3054
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/has_key.rb:24
3055
+ def has_key(key); end
3056
+
3057
+ # Matches +Hash+ containing +keys+.
3058
+ #
3059
+ # @example Actual parameter contains entry with expected keys.
3060
+ # object = mock()
3061
+ # object.expects(:method_1).with(has_keys(:key_1, :key_2))
3062
+ # object.method_1(:key_1 => 1, :key_2 => 2, :key_3 => 3)
3063
+ # # no error raised
3064
+ # @example Actual parameter does not contain all expected keys.
3065
+ # object = mock()
3066
+ # object.expects(:method_1).with(has_keys(:key_1, :key_2))
3067
+ # object.method_1(:key_2 => 2)
3068
+ # # error raised, because method_1 was not called with Hash containing key: :key_1
3069
+ # @param keys [*Array<Object>] expected keys.
3070
+ # @return [HasKeys] parameter matcher.
3071
+ # @see Expectation#with
3072
+ #
3073
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/has_keys.rb:24
3074
+ def has_keys(*keys); end
3075
+
3076
+ # Matches +Hash+ containing +value+.
3077
+ #
3078
+ # @example Actual parameter contains entry with expected value.
3079
+ # object = mock()
3080
+ # object.expects(:method_1).with(has_value(1))
3081
+ # object.method_1('key_1' => 1, 'key_2' => 2)
3082
+ # # no error raised
3083
+ # @example Actual parameter does not contain entry with expected value.
3084
+ # object = mock()
3085
+ # object.expects(:method_1).with(has_value(1))
3086
+ # object.method_1('key_2' => 2)
3087
+ # # error raised, because method_1 was not called with Hash containing value: 1
3088
+ # @param value [Object] expected value.
3089
+ # @return [HasValue] parameter matcher.
3090
+ # @see Expectation#with
3091
+ #
3092
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/has_value.rb:24
3093
+ def has_value(value); end
3094
+
3095
+ # Matches any object that responds with +true+ to +include?(item)+
3096
+ # for all items.
3097
+ #
3098
+ # @example Actual parameter includes all items.
3099
+ # object = mock()
3100
+ # object.expects(:method_1).with(includes('foo', 'bar'))
3101
+ # object.method_1(['foo', 'bar', 'baz'])
3102
+ # # no error raised
3103
+ # @example Actual parameter does not include all items.
3104
+ # object.method_1(['foo', 'baz'])
3105
+ # # error raised, because ['foo', 'baz'] does not include 'bar'.
3106
+ # @example Actual parameter includes item which matches nested matcher.
3107
+ # object = mock()
3108
+ # object.expects(:method_1).with(includes(has_key(:key)))
3109
+ # object.method_1(['foo', 'bar', {:key => 'baz'}])
3110
+ # # no error raised
3111
+ # @example Actual parameter does not include item matching nested matcher.
3112
+ # object.method_1(['foo', 'bar', {:other_key => 'baz'}])
3113
+ # # error raised, because no element matches `has_key(:key)` matcher
3114
+ # @example Actual parameter is a String including substring.
3115
+ # object = mock()
3116
+ # object.expects(:method_1).with(includes('bar'))
3117
+ # object.method_1('foobarbaz')
3118
+ # # no error raised
3119
+ # @example Actual parameter is a String not including substring.
3120
+ # object.method_1('foobaz')
3121
+ # # error raised, because 'foobaz' does not include 'bar'
3122
+ # @example Actual parameter is a Hash including the given key.
3123
+ # object = mock()
3124
+ # object.expects(:method_1).with(includes(:bar))
3125
+ # object.method_1({:foo => 1, :bar => 2})
3126
+ # # no error raised
3127
+ # @example Actual parameter is a Hash without the given key.
3128
+ # object.method_1({:foo => 1, :baz => 2})
3129
+ # # error raised, because hash does not include key 'bar'
3130
+ # @example Actual parameter is a Hash with a key matching the given matcher.
3131
+ # object = mock()
3132
+ # object.expects(:method_1).with(includes(regexp_matches(/ar/)))
3133
+ # object.method_1({'foo' => 1, 'bar' => 2})
3134
+ # # no error raised
3135
+ # @example Actual parameter is a Hash no key matching the given matcher.
3136
+ # object.method_1({'foo' => 1, 'baz' => 3})
3137
+ # # error raised, because hash does not include a key matching /ar/
3138
+ # @param items [*Array] expected items.
3139
+ # @return [Includes] parameter matcher.
3140
+ # @see Expectation#with
3141
+ #
3142
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/includes.rb:63
3143
+ def includes(*items); end
3144
+
3145
+ # Matches any object that is an instance of +klass+
3146
+ #
3147
+ # @example Actual parameter is an instance of +String+.
3148
+ # object = mock()
3149
+ # object.expects(:method_1).with(instance_of(String))
3150
+ # object.method_1('string')
3151
+ # # no error raised
3152
+ # @example Actual parameter is not an instance of +String+.
3153
+ # object = mock()
3154
+ # object.expects(:method_1).with(instance_of(String))
3155
+ # object.method_1(99)
3156
+ # # error raised, because method_1 was not called with an instance of String
3157
+ # @param klass [Class] expected class.
3158
+ # @return [InstanceOf] parameter matcher.
3159
+ # @see Expectation#with
3160
+ # @see Kernel#instance_of?
3161
+ #
3162
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/instance_of.rb:24
3163
+ def instance_of(klass); end
3164
+
3165
+ # Matches any object that is a +klass+.
3166
+ #
3167
+ # @example Actual parameter is a +Integer+.
3168
+ # object = mock()
3169
+ # object.expects(:method_1).with(is_a(Integer))
3170
+ # object.method_1(99)
3171
+ # # no error raised
3172
+ # @example Actual parameter is not a +Integer+.
3173
+ # object = mock()
3174
+ # object.expects(:method_1).with(is_a(Integer))
3175
+ # object.method_1('string')
3176
+ # # error raised, because method_1 was not called with an Integer
3177
+ # @param klass [Class] expected class.
3178
+ # @return [IsA] parameter matcher.
3179
+ # @see Expectation#with
3180
+ # @see Kernel#is_a?
3181
+ #
3182
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/is_a.rb:25
3183
+ def is_a(klass); end
3184
+
3185
+ # Matches any +Object+ that is a kind of +klass+.
3186
+ #
3187
+ # @example Actual parameter is a kind of +Integer+.
3188
+ # object = mock()
3189
+ # object.expects(:method_1).with(kind_of(Integer))
3190
+ # object.method_1(99)
3191
+ # # no error raised
3192
+ # @example Actual parameter is not a kind of +Integer+.
3193
+ # object = mock()
3194
+ # object.expects(:method_1).with(kind_of(Integer))
3195
+ # object.method_1('string')
3196
+ # # error raised, because method_1 was not called with a kind of Integer
3197
+ # @param klass [Class] expected class.
3198
+ # @return [KindOf] parameter matcher.
3199
+ # @see Expectation#with
3200
+ # @see Kernel#kind_of?
3201
+ #
3202
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/kind_of.rb:24
3203
+ def kind_of(klass); end
3204
+
3205
+ # Matches optional parameters if available.
3206
+ #
3207
+ # @example Only the two required parameters are supplied and they both match their expected value.
3208
+ # object = mock()
3209
+ # object.expects(:method_1).with(1, 2, optionally(3, 4))
3210
+ # object.method_1(1, 2)
3211
+ # # no error raised
3212
+ # @example Both required parameters and one of the optional parameters are supplied and they all match their expected value.
3213
+ # object = mock()
3214
+ # object.expects(:method_1).with(1, 2, optionally(3, 4))
3215
+ # object.method_1(1, 2, 3)
3216
+ # # no error raised
3217
+ # @example Both required parameters and both of the optional parameters are supplied and they all match their expected value.
3218
+ # object = mock()
3219
+ # object.expects(:method_1).with(1, 2, optionally(3, 4))
3220
+ # object.method_1(1, 2, 3, 4)
3221
+ # # no error raised
3222
+ # @example One of the actual optional parameters does not match the expected value.
3223
+ # object = mock()
3224
+ # object.expects(:method_1).with(1, 2, optionally(3, 4))
3225
+ # object.method_1(1, 2, 3, 5)
3226
+ # # error raised, because optional parameters did not match
3227
+ # @param matchers [*Array<Base>] matchers for optional parameters.
3228
+ # @return [Optionally] parameter matcher.
3229
+ # @see Expectation#with
3230
+ #
3231
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/optionally.rb:33
3232
+ def optionally(*matchers); end
3233
+
3234
+ # Matches any object that matches +regexp+.
3235
+ #
3236
+ # @example Actual parameter is matched by specified regular expression.
3237
+ # object = mock()
3238
+ # object.expects(:method_1).with(regexp_matches(/e/))
3239
+ # object.method_1('hello')
3240
+ # # no error raised
3241
+ # @example Actual parameter is not matched by specified regular expression.
3242
+ # object = mock()
3243
+ # object.expects(:method_1).with(regexp_matches(/a/))
3244
+ # object.method_1('hello')
3245
+ # # error raised, because method_1 was not called with a parameter that matched the
3246
+ # # regular expression
3247
+ # @param regexp [Regexp] regular expression to match.
3248
+ # @return [RegexpMatches] parameter matcher.
3249
+ # @see Expectation#with
3250
+ #
3251
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/regexp_matches.rb:24
3252
+ def regexp_matches(regexp); end
3253
+
3254
+ # Matches any object that responds to +message+ with +result+. To put it another way, it tests the quack, not the duck.
3255
+ #
3256
+ # @example Actual parameter responds with "FOO" when :upcase is invoked.
3257
+ # object = mock()
3258
+ # object.expects(:method_1).with(responds_with(:upcase, "FOO"))
3259
+ # object.method_1("foo")
3260
+ # # no error raised, because "foo".upcase == "FOO"
3261
+ # @example Actual parameter does not respond with "FOO" when :upcase is invoked.
3262
+ # object = mock()
3263
+ # object.expects(:method_1).with(responds_with(:upcase, "BAR"))
3264
+ # object.method_1("foo")
3265
+ # # error raised, because "foo".upcase != "BAR"
3266
+ # @param message [Symbol] method to invoke.
3267
+ # @param result [Object] expected result of sending +message+.
3268
+ # @return [RespondsWith] parameter matcher.
3269
+ # @see Expectation#with
3270
+ #
3271
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/responds_with.rb:25
3272
+ def responds_with(message, result); end
3273
+
3274
+ # Matches any YAML that represents the specified +object+
3275
+ #
3276
+ # @example Actual parameter is YAML equivalent of specified +object+.
3277
+ # object = mock()
3278
+ # object.expects(:method_1).with(yaml_equivalent(1, 2, 3))
3279
+ # object.method_1("--- \n- 1\n- 2\n- 3\n")
3280
+ # # no error raised
3281
+ # @example Actual parameter is not YAML equivalent of specified +object+.
3282
+ # object = mock()
3283
+ # object.expects(:method_1).with(yaml_equivalent(1, 2, 3))
3284
+ # object.method_1("--- \n- 1\n- 2\n")
3285
+ # # error raised, because method_1 was not called with YAML representing the specified Array
3286
+ # @param object [Object] object whose YAML to compare.
3287
+ # @return [YamlEquivalent] parameter matcher.
3288
+ # @see Expectation#with
3289
+ #
3290
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/yaml_equivalent.rb:24
3291
+ def yaml_equivalent(object); end
3292
+
3293
+ private
3294
+
3295
+ # @private
3296
+ #
3297
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/has_entry.rb:82
3298
+ def parse_option(option); end
3299
+ end
3300
+
3301
+ # Parameter matcher which combines a number of other matchers using a logical AND.
3302
+ #
3303
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/all_of.rb:29
3304
+ class Mocha::ParameterMatchers::AllOf < ::Mocha::ParameterMatchers::Base
3305
+ # @private
3306
+ # @return [AllOf] a new instance of AllOf
3307
+ #
3308
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/all_of.rb:30
3309
+ def initialize(*matchers); end
3310
+
3311
+ # @private
3312
+ # @return [Boolean]
3313
+ #
3314
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/all_of.rb:35
3315
+ def matches?(available_parameters); end
3316
+
3317
+ # @private
3318
+ #
3319
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/all_of.rb:41
3320
+ def mocha_inspect; end
3321
+ end
3322
+
3323
+ # Parameter matcher which combines a number of other matchers using a logical OR.
3324
+ #
3325
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/any_of.rb:35
3326
+ class Mocha::ParameterMatchers::AnyOf < ::Mocha::ParameterMatchers::Base
3327
+ # @private
3328
+ # @return [AnyOf] a new instance of AnyOf
3329
+ #
3330
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/any_of.rb:36
3331
+ def initialize(*matchers); end
3332
+
3333
+ # @private
3334
+ # @return [Boolean]
3335
+ #
3336
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/any_of.rb:41
3337
+ def matches?(available_parameters); end
3338
+
3339
+ # @private
3340
+ #
3341
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/any_of.rb:47
3342
+ def mocha_inspect; end
3343
+ end
3344
+
3345
+ # Parameter matcher which always matches whatever the parameters.
3346
+ #
3347
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/any_parameters.rb:27
3348
+ class Mocha::ParameterMatchers::AnyParameters < ::Mocha::ParameterMatchers::Base
3349
+ # @private
3350
+ # @return [Boolean]
3351
+ #
3352
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/any_parameters.rb:28
3353
+ def matches?(available_parameters); end
3354
+
3355
+ # @private
3356
+ #
3357
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/any_parameters.rb:36
3358
+ def mocha_inspect; end
3359
+ end
3360
+
3361
+ # Parameter matcher which always matches a single parameter.
3362
+ #
3363
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/anything.rb:24
3364
+ class Mocha::ParameterMatchers::Anything < ::Mocha::ParameterMatchers::Base
3365
+ # @private
3366
+ # @return [Boolean]
3367
+ #
3368
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/anything.rb:25
3369
+ def matches?(available_parameters); end
3370
+
3371
+ # @private
3372
+ #
3373
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/anything.rb:31
3374
+ def mocha_inspect; end
3375
+ end
3376
+
3377
+ # @abstract Subclass and implement +#matches?+ and +#mocha_inspect+ to define a custom matcher. Also add a suitably named instance method to {ParameterMatchers} to build an instance of the new matcher c.f. {#equals}.
3378
+ #
3379
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/base.rb:4
3380
+ class Mocha::ParameterMatchers::Base
3381
+ # A shorthand way of combining two matchers when both must match.
3382
+ #
3383
+ # Returns a new {AllOf} parameter matcher combining two matchers using a logical AND.
3384
+ #
3385
+ # This shorthand will not work with an implicit equals match. Instead, an explicit {Equals} matcher should be used.
3386
+ #
3387
+ # @example Alternative ways to combine matchers with a logical AND.
3388
+ # object = mock()
3389
+ # object.expects(:run).with(all_of(has_key(:foo), has_key(:bar)))
3390
+ # object.run(:foo => 'foovalue', :bar => 'barvalue')
3391
+ #
3392
+ # # is exactly equivalent to
3393
+ #
3394
+ # object.expects(:run).with(has_key(:foo) & has_key(:bar))
3395
+ # object.run(:foo => 'foovalue', :bar => 'barvalue)
3396
+ # @param other [Base] parameter matcher.
3397
+ # @return [AllOf] parameter matcher.
3398
+ # @see Expectation#with
3399
+ #
3400
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/base.rb:30
3401
+ def &(other); end
3402
+
3403
+ # @private
3404
+ #
3405
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/base.rb:6
3406
+ def to_matcher; end
3407
+
3408
+ # A shorthand way of combining two matchers when at least one must match.
3409
+ #
3410
+ # Returns a new +AnyOf+ parameter matcher combining two matchers using a logical OR.
3411
+ #
3412
+ # This shorthand will not work with an implicit equals match. Instead, an explicit {Equals} matcher should be used.
3413
+ #
3414
+ # @example Alternative ways to combine matchers with a logical OR.
3415
+ # object = mock()
3416
+ # object.expects(:run).with(any_of(has_key(:foo), has_key(:bar)))
3417
+ # object.run(:foo => 'foovalue')
3418
+ #
3419
+ # # is exactly equivalent to
3420
+ #
3421
+ # object.expects(:run).with(has_key(:foo) | has_key(:bar))
3422
+ # object.run(:foo => 'foovalue')
3423
+ # @example Using an explicit {Equals} matcher in combination with {#|}.
3424
+ # object.expects(:run).with(equals(1) | equals(2))
3425
+ # object.run(1) # passes
3426
+ # object.run(2) # passes
3427
+ # object.run(3) # fails
3428
+ # @param other [Base] parameter matcher.
3429
+ # @return [AnyOf] parameter matcher.
3430
+ # @see Expectation#with
3431
+ #
3432
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/base.rb:60
3433
+ def |(other); end
3434
+ end
3435
+
3436
+ # Parameter matcher which matches when actual parameter equals expected value.
3437
+ #
3438
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/equals.rb:30
3439
+ class Mocha::ParameterMatchers::Equals < ::Mocha::ParameterMatchers::Base
3440
+ # @private
3441
+ # @return [Equals] a new instance of Equals
3442
+ #
3443
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/equals.rb:31
3444
+ def initialize(value); end
3445
+
3446
+ # @private
3447
+ # @return [Boolean]
3448
+ #
3449
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/equals.rb:36
3450
+ def matches?(available_parameters); end
3451
+
3452
+ # @private
3453
+ #
3454
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/equals.rb:42
3455
+ def mocha_inspect; end
3456
+ end
3457
+
3458
+ # Parameter matcher which matches URIs with equivalent query strings.
3459
+ #
3460
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/equivalent_uri.rb:32
3461
+ class Mocha::ParameterMatchers::EquivalentUri < ::Mocha::ParameterMatchers::Base
3462
+ # @private
3463
+ # @return [EquivalentUri] a new instance of EquivalentUri
3464
+ #
3465
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/equivalent_uri.rb:33
3466
+ def initialize(uri); end
3467
+
3468
+ # @private
3469
+ # @return [Boolean]
3470
+ #
3471
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/equivalent_uri.rb:38
3472
+ def matches?(available_parameters); end
3473
+
3474
+ # @private
3475
+ #
3476
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/equivalent_uri.rb:45
3477
+ def mocha_inspect; end
3478
+
3479
+ private
3480
+
3481
+ # @private
3482
+ #
3483
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/equivalent_uri.rb:52
3484
+ def explode(uri); end
3485
+ end
3486
+
3487
+ # Parameter matcher which matches when actual parameter contains all expected +Hash+ entries.
3488
+ #
3489
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/has_entries.rb:32
3490
+ class Mocha::ParameterMatchers::HasEntries < ::Mocha::ParameterMatchers::Base
3491
+ # @private
3492
+ # @return [HasEntries] a new instance of HasEntries
3493
+ #
3494
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/has_entries.rb:33
3495
+ def initialize(entries); end
3496
+
3497
+ # @private
3498
+ # @return [Boolean]
3499
+ #
3500
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/has_entries.rb:38
3501
+ def matches?(available_parameters); end
3502
+
3503
+ # @private
3504
+ #
3505
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/has_entries.rb:45
3506
+ def mocha_inspect; end
3507
+ end
3508
+
3509
+ # Parameter matcher which matches when actual parameter contains expected +Hash+ entry.
3510
+ #
3511
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/has_entry.rb:59
3512
+ class Mocha::ParameterMatchers::HasEntry < ::Mocha::ParameterMatchers::Base
3513
+ # @private
3514
+ # @return [HasEntry] a new instance of HasEntry
3515
+ #
3516
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/has_entry.rb:60
3517
+ def initialize(key, value); end
3518
+
3519
+ # @private
3520
+ # @return [Boolean]
3521
+ #
3522
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/has_entry.rb:66
3523
+ def matches?(available_parameters); end
3524
+
3525
+ # @private
3526
+ #
3527
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/has_entry.rb:74
3528
+ def mocha_inspect; end
3529
+ end
3530
+
3531
+ # Parameter matcher which matches when actual parameter contains +Hash+ entry with expected key.
3532
+ #
3533
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/has_key.rb:30
3534
+ class Mocha::ParameterMatchers::HasKey < ::Mocha::ParameterMatchers::Base
3535
+ # @private
3536
+ # @return [HasKey] a new instance of HasKey
3537
+ #
3538
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/has_key.rb:31
3539
+ def initialize(key); end
3540
+
3541
+ # @private
3542
+ # @return [Boolean]
3543
+ #
3544
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/has_key.rb:36
3545
+ def matches?(available_parameters); end
3546
+
3547
+ # @private
3548
+ #
3549
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/has_key.rb:43
3550
+ def mocha_inspect; end
3551
+ end
3552
+
3553
+ # Parameter matcher which matches when actual parameter contains +Hash+ with all expected keys.
3554
+ #
3555
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/has_keys.rb:30
3556
+ class Mocha::ParameterMatchers::HasKeys < ::Mocha::ParameterMatchers::Base
3557
+ # @private
3558
+ # @raise [ArgumentError]
3559
+ # @return [HasKeys] a new instance of HasKeys
3560
+ #
3561
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/has_keys.rb:31
3562
+ def initialize(*keys); end
3563
+
3564
+ # @private
3565
+ # @return [Boolean]
3566
+ #
3567
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/has_keys.rb:38
3568
+ def matches?(available_parameters); end
3569
+
3570
+ # @private
3571
+ #
3572
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/has_keys.rb:48
3573
+ def mocha_inspect; end
3574
+ end
3575
+
3576
+ # Parameter matcher which matches when actual parameter contains +Hash+ entry with expected value.
3577
+ #
3578
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/has_value.rb:30
3579
+ class Mocha::ParameterMatchers::HasValue < ::Mocha::ParameterMatchers::Base
3580
+ # @private
3581
+ # @return [HasValue] a new instance of HasValue
3582
+ #
3583
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/has_value.rb:31
3584
+ def initialize(value); end
3585
+
3586
+ # @private
3587
+ # @return [Boolean]
3588
+ #
3589
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/has_value.rb:36
3590
+ def matches?(available_parameters); end
3591
+
3592
+ # @private
3593
+ #
3594
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/has_value.rb:43
3595
+ def mocha_inspect; end
3596
+ end
3597
+
3598
+ # Parameter matcher which matches when actual parameter includes expected values.
3599
+ #
3600
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/includes.rb:69
3601
+ class Mocha::ParameterMatchers::Includes < ::Mocha::ParameterMatchers::Base
3602
+ # @private
3603
+ # @return [Includes] a new instance of Includes
3604
+ #
3605
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/includes.rb:70
3606
+ def initialize(*items); end
3607
+
3608
+ # @private
3609
+ # @return [Boolean]
3610
+ #
3611
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/includes.rb:76
3612
+ def matches?(available_parameters); end
3613
+
3614
+ # @private
3615
+ #
3616
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/includes.rb:96
3617
+ def mocha_inspect; end
3618
+ end
3619
+
3620
+ # @private
3621
+ #
3622
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/instance_methods.rb:6
3623
+ module Mocha::ParameterMatchers::InstanceMethods
3624
+ # @private
3625
+ #
3626
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/instance_methods.rb:8
3627
+ def to_matcher; end
3628
+ end
3629
+
3630
+ # Parameter matcher which matches when actual parameter is an instance of the specified class.
3631
+ #
3632
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/instance_of.rb:30
3633
+ class Mocha::ParameterMatchers::InstanceOf < ::Mocha::ParameterMatchers::Base
3634
+ # @private
3635
+ # @return [InstanceOf] a new instance of InstanceOf
3636
+ #
3637
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/instance_of.rb:31
3638
+ def initialize(klass); end
3639
+
3640
+ # @private
3641
+ # @return [Boolean]
3642
+ #
3643
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/instance_of.rb:36
3644
+ def matches?(available_parameters); end
3645
+
3646
+ # @private
3647
+ #
3648
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/instance_of.rb:42
3649
+ def mocha_inspect; end
3650
+ end
3651
+
3652
+ # Parameter matcher which matches when actual parameter is a specific class.
3653
+ #
3654
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/is_a.rb:31
3655
+ class Mocha::ParameterMatchers::IsA < ::Mocha::ParameterMatchers::Base
3656
+ # @private
3657
+ # @return [IsA] a new instance of IsA
3658
+ #
3659
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/is_a.rb:32
3660
+ def initialize(klass); end
3661
+
3662
+ # @private
3663
+ # @return [Boolean]
3664
+ #
3665
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/is_a.rb:37
3666
+ def matches?(available_parameters); end
3667
+
3668
+ # @private
3669
+ #
3670
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/is_a.rb:43
3671
+ def mocha_inspect; end
3672
+ end
3673
+
3674
+ # Parameter matcher which matches when actual parameter is a kind of specified class.
3675
+ #
3676
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/kind_of.rb:30
3677
+ class Mocha::ParameterMatchers::KindOf < ::Mocha::ParameterMatchers::Base
3678
+ # @private
3679
+ # @return [KindOf] a new instance of KindOf
3680
+ #
3681
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/kind_of.rb:31
3682
+ def initialize(klass); end
3683
+
3684
+ # @private
3685
+ # @return [Boolean]
3686
+ #
3687
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/kind_of.rb:36
3688
+ def matches?(available_parameters); end
3689
+
3690
+ # @private
3691
+ #
3692
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/kind_of.rb:44
3693
+ def mocha_inspect; end
3694
+ end
3695
+
3696
+ # Parameter matcher which inverts the logic of the specified matcher using a logical NOT operation.
3697
+ #
3698
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/not.rb:30
3699
+ class Mocha::ParameterMatchers::Not < ::Mocha::ParameterMatchers::Base
3700
+ # @private
3701
+ # @return [Not] a new instance of Not
3702
+ #
3703
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/not.rb:31
3704
+ def initialize(matcher); end
3705
+
3706
+ # @private
3707
+ # @return [Boolean]
3708
+ #
3709
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/not.rb:36
3710
+ def matches?(available_parameters); end
3711
+
3712
+ # @private
3713
+ #
3714
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/not.rb:42
3715
+ def mocha_inspect; end
3716
+ end
3717
+
3718
+ # Parameter matcher which allows optional parameters to be specified.
3719
+ #
3720
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/optionally.rb:39
3721
+ class Mocha::ParameterMatchers::Optionally < ::Mocha::ParameterMatchers::Base
3722
+ # @private
3723
+ # @return [Optionally] a new instance of Optionally
3724
+ #
3725
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/optionally.rb:40
3726
+ def initialize(*parameters); end
3727
+
3728
+ # @private
3729
+ # @return [Boolean]
3730
+ #
3731
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/optionally.rb:45
3732
+ def matches?(available_parameters); end
3733
+
3734
+ # @private
3735
+ #
3736
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/optionally.rb:56
3737
+ def mocha_inspect; end
3738
+ end
3739
+
3740
+ # Parameter matcher which matches if specified regular expression matches actual paramter.
3741
+ #
3742
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/regexp_matches.rb:30
3743
+ class Mocha::ParameterMatchers::RegexpMatches < ::Mocha::ParameterMatchers::Base
3744
+ # @private
3745
+ # @return [RegexpMatches] a new instance of RegexpMatches
3746
+ #
3747
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/regexp_matches.rb:31
3748
+ def initialize(regexp); end
3749
+
3750
+ # @private
3751
+ # @return [Boolean]
3752
+ #
3753
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/regexp_matches.rb:36
3754
+ def matches?(available_parameters); end
3755
+
3756
+ # @private
3757
+ #
3758
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/regexp_matches.rb:43
3759
+ def mocha_inspect; end
3760
+ end
3761
+
3762
+ # Parameter matcher which matches if actual parameter returns expected result when specified method is invoked.
3763
+ #
3764
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/responds_with.rb:31
3765
+ class Mocha::ParameterMatchers::RespondsWith < ::Mocha::ParameterMatchers::Base
3766
+ # @private
3767
+ # @return [RespondsWith] a new instance of RespondsWith
3768
+ #
3769
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/responds_with.rb:32
3770
+ def initialize(message, result); end
3771
+
3772
+ # @private
3773
+ # @return [Boolean]
3774
+ #
3775
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/responds_with.rb:38
3776
+ def matches?(available_parameters); end
3777
+
3778
+ # @private
3779
+ #
3780
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/responds_with.rb:44
3781
+ def mocha_inspect; end
3782
+ end
3783
+
3784
+ # Parameter matcher which matches if actual parameter is YAML equivalent of specified object.
3785
+ #
3786
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/yaml_equivalent.rb:30
3787
+ class Mocha::ParameterMatchers::YamlEquivalent < ::Mocha::ParameterMatchers::Base
3788
+ # @private
3789
+ # @return [YamlEquivalent] a new instance of YamlEquivalent
3790
+ #
3791
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/yaml_equivalent.rb:31
3792
+ def initialize(object); end
3793
+
3794
+ # @private
3795
+ # @return [Boolean]
3796
+ #
3797
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/yaml_equivalent.rb:36
3798
+ def matches?(available_parameters); end
3799
+
3800
+ # @private
3801
+ #
3802
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/yaml_equivalent.rb:44
3803
+ def mocha_inspect; end
3804
+ end
3805
+
3806
+ # source://mocha-1.14.0/lib/mocha/parameters_matcher.rb:5
3807
+ class Mocha::ParametersMatcher
3808
+ # @return [ParametersMatcher] a new instance of ParametersMatcher
3809
+ #
3810
+ # source://mocha-1.14.0/lib/mocha/parameters_matcher.rb:6
3811
+ def initialize(expected_parameters = T.unsafe(nil), &matching_block); end
3812
+
3813
+ # @return [Boolean]
3814
+ #
3815
+ # source://mocha-1.14.0/lib/mocha/parameters_matcher.rb:11
3816
+ def match?(actual_parameters = T.unsafe(nil)); end
3817
+
3818
+ # source://mocha-1.14.0/lib/mocha/parameters_matcher.rb:30
3819
+ def matchers; end
3820
+
3821
+ # source://mocha-1.14.0/lib/mocha/parameters_matcher.rb:23
3822
+ def mocha_inspect; end
3823
+
3824
+ # @return [Boolean]
3825
+ #
3826
+ # source://mocha-1.14.0/lib/mocha/parameters_matcher.rb:19
3827
+ def parameters_match?(actual_parameters); end
3828
+ end
3829
+
3830
+ # source://mocha-1.14.0/lib/mocha/ruby_version.rb:3
3831
+ Mocha::RUBY_V2_PLUS = T.let(T.unsafe(nil), TrueClass)
3832
+
3833
+ # source://mocha-1.14.0/lib/mocha/raised_exception.rb:2
3834
+ class Mocha::RaisedException
3835
+ # @return [RaisedException] a new instance of RaisedException
3836
+ #
3837
+ # source://mocha-1.14.0/lib/mocha/raised_exception.rb:3
3838
+ def initialize(exception); end
3839
+
3840
+ # source://mocha-1.14.0/lib/mocha/raised_exception.rb:7
3841
+ def mocha_inspect; end
3842
+ end
3843
+
3844
+ # source://mocha-1.14.0/lib/mocha/return_values.rb:4
3845
+ class Mocha::ReturnValues
3846
+ # @return [ReturnValues] a new instance of ReturnValues
3847
+ #
3848
+ # source://mocha-1.14.0/lib/mocha/return_values.rb:11
3849
+ def initialize(*values); end
3850
+
3851
+ # source://mocha-1.14.0/lib/mocha/return_values.rb:23
3852
+ def +(other); end
3853
+
3854
+ # source://mocha-1.14.0/lib/mocha/return_values.rb:15
3855
+ def next(invocation); end
3856
+
3857
+ # Returns the value of attribute values.
3858
+ #
3859
+ # source://mocha-1.14.0/lib/mocha/return_values.rb:9
3860
+ def values; end
3861
+
3862
+ # Sets the attribute values
3863
+ #
3864
+ # @param value the value to set the attribute values to.
3865
+ #
3866
+ # source://mocha-1.14.0/lib/mocha/return_values.rb:9
3867
+ def values=(_arg0); end
3868
+
3869
+ class << self
3870
+ # source://mocha-1.14.0/lib/mocha/return_values.rb:5
3871
+ def build(*values); end
3872
+ end
3873
+ end
3874
+
3875
+ # Used to constrain the order in which expectations can occur.
3876
+ #
3877
+ # @see API#sequence
3878
+ # @see Expectation#in_sequence
3879
+ #
3880
+ # source://mocha-1.14.0/lib/mocha/sequence.rb:6
3881
+ class Mocha::Sequence
3882
+ # @private
3883
+ # @return [Sequence] a new instance of Sequence
3884
+ #
3885
+ # source://mocha-1.14.0/lib/mocha/sequence.rb:24
3886
+ def initialize(name); end
3887
+
3888
+ # @private
3889
+ #
3890
+ # source://mocha-1.14.0/lib/mocha/sequence.rb:30
3891
+ def constrain_as_next_in_sequence(expectation); end
3892
+
3893
+ # @private
3894
+ #
3895
+ # source://mocha-1.14.0/lib/mocha/sequence.rb:42
3896
+ def mocha_inspect; end
3897
+
3898
+ # @private
3899
+ # @return [Boolean]
3900
+ #
3901
+ # source://mocha-1.14.0/lib/mocha/sequence.rb:37
3902
+ def satisfied_to_index?(index); end
3903
+ end
3904
+
3905
+ # @private
3906
+ #
3907
+ # source://mocha-1.14.0/lib/mocha/sequence.rb:8
3908
+ class Mocha::Sequence::InSequenceOrderingConstraint
3909
+ # @return [InSequenceOrderingConstraint] a new instance of InSequenceOrderingConstraint
3910
+ #
3911
+ # source://mocha-1.14.0/lib/mocha/sequence.rb:9
3912
+ def initialize(sequence, index); end
3913
+
3914
+ # @return [Boolean]
3915
+ #
3916
+ # source://mocha-1.14.0/lib/mocha/sequence.rb:14
3917
+ def allows_invocation_now?; end
3918
+
3919
+ # source://mocha-1.14.0/lib/mocha/sequence.rb:18
3920
+ def mocha_inspect; end
3921
+ end
3922
+
3923
+ # source://mocha-1.14.0/lib/mocha/single_return_value.rb:4
3924
+ class Mocha::SingleReturnValue
3925
+ # @return [SingleReturnValue] a new instance of SingleReturnValue
3926
+ #
3927
+ # source://mocha-1.14.0/lib/mocha/single_return_value.rb:5
3928
+ def initialize(value); end
3929
+
3930
+ # source://mocha-1.14.0/lib/mocha/single_return_value.rb:9
3931
+ def evaluate(invocation); end
3932
+ end
3933
+
3934
+ # A state machine that is used to constrain the order of invocations.
3935
+ # An invocation can be constrained to occur when a state {#is}, or {#is_not}, active.
3936
+ #
3937
+ # source://mocha-1.14.0/lib/mocha/state_machine.rb:4
3938
+ class Mocha::StateMachine
3939
+ # @private
3940
+ # @return [StateMachine] a new instance of StateMachine
3941
+ #
3942
+ # source://mocha-1.14.0/lib/mocha/state_machine.rb:41
3943
+ def initialize(name); end
3944
+
3945
+ # Put the {StateMachine} into the +next_state_name+.
3946
+ #
3947
+ # @param next_state_name [String] name of new state
3948
+ #
3949
+ # source://mocha-1.14.0/lib/mocha/state_machine.rb:58
3950
+ def become(next_state_name); end
3951
+
3952
+ # @private
3953
+ #
3954
+ # source://mocha-1.14.0/lib/mocha/state_machine.rb:38
3955
+ def current_state; end
3956
+
3957
+ # @private
3958
+ #
3959
+ # source://mocha-1.14.0/lib/mocha/state_machine.rb:38
3960
+ def current_state=(_arg0); end
3961
+
3962
+ # Provides mechanisms to (a) determine whether the {StateMachine} is in a given state; or (b) to change the {StateMachine} into the given state.
3963
+ #
3964
+ # @overload is
3965
+ # @overload is
3966
+ # @param state_name [String] name of expected/desired state.
3967
+ # @return [StatePredicate, State] (a) state predicate which, when queried, will indicate whether the {StateMachine} is in the given state; or (b) state which, when activated, will change the {StateMachine} into the given state.
3968
+ #
3969
+ # source://mocha-1.14.0/lib/mocha/state_machine.rb:76
3970
+ def is(state_name); end
3971
+
3972
+ # Provides a mechanism to determine whether the {StateMachine} is *not* in the state specified by +unexpected_state_name+ at some point in the future.
3973
+ #
3974
+ # @param unexpected_state_name [String] name of unexpected state.
3975
+ # @return [StatePredicate] state predicate which, when queried, will indicate whether the {StateMachine} is *not* in the state specified by +unexpected_state_name+.
3976
+ #
3977
+ # source://mocha-1.14.0/lib/mocha/state_machine.rb:84
3978
+ def is_not(unexpected_state_name); end
3979
+
3980
+ # @private
3981
+ #
3982
+ # source://mocha-1.14.0/lib/mocha/state_machine.rb:89
3983
+ def mocha_inspect; end
3984
+
3985
+ # @private
3986
+ #
3987
+ # source://mocha-1.14.0/lib/mocha/state_machine.rb:35
3988
+ def name; end
3989
+
3990
+ # Put the {StateMachine} into the state specified by +initial_state_name+.
3991
+ #
3992
+ # @param initial_state_name [String] name of initial state
3993
+ # @return [StateMachine] state machine, thereby allowing invocations of other {StateMachine} methods to be chained.
3994
+ #
3995
+ # source://mocha-1.14.0/lib/mocha/state_machine.rb:50
3996
+ def starts_as(initial_state_name); end
3997
+ end
3998
+
3999
+ # Provides a mechanism to change the state of a {StateMachine} at some point in the future.
4000
+ #
4001
+ # source://mocha-1.14.0/lib/mocha/state_machine.rb:28
4002
+ class Mocha::StateMachine::State < ::Mocha::StateMachine::StatePredicate
4003
+ # @private
4004
+ #
4005
+ # source://mocha-1.14.0/lib/mocha/state_machine.rb:29
4006
+ def activate; end
4007
+ end
4008
+
4009
+ # Provides the ability to determine whether a {StateMachine} is in a specified state at some point in the future.
4010
+ #
4011
+ # source://mocha-1.14.0/lib/mocha/state_machine.rb:6
4012
+ class Mocha::StateMachine::StatePredicate
4013
+ # @private
4014
+ # @return [StatePredicate] a new instance of StatePredicate
4015
+ #
4016
+ # source://mocha-1.14.0/lib/mocha/state_machine.rb:8
4017
+ def initialize(state_machine, state, description, &active_check); end
4018
+
4019
+ # @private
4020
+ # @return [Boolean]
4021
+ #
4022
+ # source://mocha-1.14.0/lib/mocha/state_machine.rb:16
4023
+ def active?; end
4024
+
4025
+ # @private
4026
+ #
4027
+ # source://mocha-1.14.0/lib/mocha/state_machine.rb:21
4028
+ def mocha_inspect; end
4029
+ end
4030
+
4031
+ # source://mocha-1.14.0/lib/mocha/stubbed_method.rb:5
4032
+ class Mocha::StubbedMethod
4033
+ # @return [StubbedMethod] a new instance of StubbedMethod
4034
+ #
4035
+ # source://mocha-1.14.0/lib/mocha/stubbed_method.rb:10
4036
+ def initialize(stubbee, method_name); end
4037
+
4038
+ def ==(_arg0); end
4039
+
4040
+ # source://mocha-1.14.0/lib/mocha/stubbed_method.rb:57
4041
+ def define_new_method; end
4042
+
4043
+ # source://mocha-1.14.0/lib/mocha/stubbed_method.rb:38
4044
+ def hide_original_method; end
4045
+
4046
+ # @return [Boolean]
4047
+ #
4048
+ # source://mocha-1.14.0/lib/mocha/stubbed_method.rb:82
4049
+ def matches?(other); end
4050
+
4051
+ # Returns the value of attribute method_name.
4052
+ #
4053
+ # source://mocha-1.14.0/lib/mocha/stubbed_method.rb:8
4054
+ def method_name; end
4055
+
4056
+ # source://mocha-1.14.0/lib/mocha/stubbed_method.rb:30
4057
+ def mock; end
4058
+
4059
+ # source://mocha-1.14.0/lib/mocha/stubbed_method.rb:66
4060
+ def remove_new_method; end
4061
+
4062
+ # source://mocha-1.14.0/lib/mocha/stubbed_method.rb:34
4063
+ def reset_mocha; end
4064
+
4065
+ # source://mocha-1.14.0/lib/mocha/stubbed_method.rb:74
4066
+ def restore_original_method; end
4067
+
4068
+ # source://mocha-1.14.0/lib/mocha/stubbed_method.rb:70
4069
+ def store_original_method; end
4070
+
4071
+ # source://mocha-1.14.0/lib/mocha/stubbed_method.rb:17
4072
+ def stub; end
4073
+
4074
+ # Returns the value of attribute stubbee.
4075
+ #
4076
+ # source://mocha-1.14.0/lib/mocha/stubbed_method.rb:8
4077
+ def stubbee; end
4078
+
4079
+ # source://mocha-1.14.0/lib/mocha/stubbed_method.rb:89
4080
+ def to_s; end
4081
+
4082
+ # source://mocha-1.14.0/lib/mocha/stubbed_method.rb:22
4083
+ def unstub; end
4084
+
4085
+ private
4086
+
4087
+ # source://mocha-1.14.0/lib/mocha/stubbed_method.rb:108
4088
+ def remove_original_method_from_stubbee; end
4089
+
4090
+ # source://mocha-1.14.0/lib/mocha/stubbed_method.rb:95
4091
+ def retain_original_visibility(method_owner); end
4092
+
4093
+ # source://mocha-1.14.0/lib/mocha/stubbed_method.rb:100
4094
+ def store_original_method_visibility; end
4095
+
4096
+ # @return [Boolean]
4097
+ #
4098
+ # source://mocha-1.14.0/lib/mocha/stubbed_method.rb:104
4099
+ def stub_method_overwrites_original_method?; end
4100
+
4101
+ # source://mocha-1.14.0/lib/mocha/stubbed_method.rb:121
4102
+ def stub_method_owner; end
4103
+
4104
+ # source://mocha-1.14.0/lib/mocha/stubbed_method.rb:116
4105
+ def use_prepended_module_for_stub_method; end
4106
+
4107
+ # @return [Boolean]
4108
+ #
4109
+ # source://mocha-1.14.0/lib/mocha/stubbed_method.rb:112
4110
+ def use_prepended_module_for_stub_method?; end
4111
+ end
4112
+
4113
+ # source://mocha-1.14.0/lib/mocha/stubbed_method.rb:6
4114
+ class Mocha::StubbedMethod::PrependedModule < ::Module; end
4115
+
4116
+ # Exception raised when stubbing a particular method is not allowed.
4117
+ #
4118
+ # @see Configuration.prevent
4119
+ #
4120
+ # source://mocha-1.14.0/lib/mocha/stubbing_error.rb:7
4121
+ class Mocha::StubbingError < ::Mocha::ErrorWithFilteredBacktrace; end
4122
+
4123
+ # source://mocha-1.14.0/lib/mocha/thrower.rb:2
4124
+ class Mocha::Thrower
4125
+ # @return [Thrower] a new instance of Thrower
4126
+ #
4127
+ # source://mocha-1.14.0/lib/mocha/thrower.rb:3
4128
+ def initialize(tag, object = T.unsafe(nil)); end
4129
+
4130
+ # source://mocha-1.14.0/lib/mocha/thrower.rb:8
4131
+ def evaluate(invocation); end
4132
+ end
4133
+
4134
+ # source://mocha-1.14.0/lib/mocha/thrown_object.rb:2
4135
+ class Mocha::ThrownObject
4136
+ # @return [ThrownObject] a new instance of ThrownObject
4137
+ #
4138
+ # source://mocha-1.14.0/lib/mocha/thrown_object.rb:3
4139
+ def initialize(tag, value = T.unsafe(nil)); end
4140
+
4141
+ # source://mocha-1.14.0/lib/mocha/thrown_object.rb:8
4142
+ def mocha_inspect; end
4143
+ end
4144
+
4145
+ # source://mocha-1.14.0/lib/mocha/version.rb:2
4146
+ Mocha::VERSION = T.let(T.unsafe(nil), String)
4147
+
4148
+ # source://mocha-1.14.0/lib/mocha/yield_parameters.rb:2
4149
+ class Mocha::YieldParameters
4150
+ # @return [YieldParameters] a new instance of YieldParameters
4151
+ #
4152
+ # source://mocha-1.14.0/lib/mocha/yield_parameters.rb:3
4153
+ def initialize; end
4154
+
4155
+ # source://mocha-1.14.0/lib/mocha/yield_parameters.rb:15
4156
+ def add(*parameter_groups); end
4157
+
4158
+ # source://mocha-1.14.0/lib/mocha/yield_parameters.rb:7
4159
+ def next_invocation; end
4160
+ end
4161
+
4162
+ # @private
4163
+ #
4164
+ # source://mocha-1.14.0/lib/mocha/parameter_matchers/instance_methods.rb:16
4165
+ class Object < ::BasicObject
4166
+ include ::ActiveSupport::ForkTracker::CoreExt
4167
+ include ::Kernel
4168
+ include ::Mocha::ParameterMatchers::InstanceMethods
4169
+ include ::Mocha::Inspect::ObjectMethods
4170
+ include ::Mocha::ObjectMethods
4171
+ end
4172
+
4173
+ # source://mocha-1.14.0/lib/mocha/inspect.rb:53
4174
+ class Time
4175
+ include ::Comparable
4176
+ include ::Mocha::Inspect::TimeMethods
4177
+ end