lunchmoney 0.10.0

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