danger-packwerk 0.7.0 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/lib/danger-packwerk/packwerk_wrapper.rb +2 -2
  3. data/lib/danger-packwerk/version.rb +1 -1
  4. data/sorbet/config +1 -0
  5. data/sorbet/rbi/gems/actionview@7.0.4.rbi +11543 -0
  6. data/sorbet/rbi/gems/activesupport@7.0.4.rbi +12959 -0
  7. data/sorbet/rbi/gems/addressable@2.8.1.rbi +1505 -0
  8. data/sorbet/rbi/gems/ast@2.4.2.rbi +522 -0
  9. data/sorbet/rbi/gems/better_html@2.0.1.rbi +286 -0
  10. data/sorbet/rbi/gems/builder@3.2.4.rbi +8 -0
  11. data/sorbet/rbi/gems/claide-plugins@0.9.2.rbi +791 -0
  12. data/sorbet/rbi/gems/claide@1.1.0.rbi +1132 -0
  13. data/sorbet/rbi/gems/coderay@1.1.3.rbi +2256 -0
  14. data/sorbet/rbi/gems/colored2@3.1.2.rbi +130 -0
  15. data/sorbet/rbi/gems/concurrent-ruby@1.1.10.rbi +8695 -0
  16. data/sorbet/rbi/gems/cork@0.3.0.rbi +248 -0
  17. data/sorbet/rbi/gems/crass@1.0.6.rbi +436 -0
  18. data/sorbet/rbi/gems/danger-plugin-api@1.0.0.rbi +8 -0
  19. data/sorbet/rbi/gems/danger@9.0.0.rbi +4722 -0
  20. data/sorbet/rbi/gems/diff-lcs@1.5.0.rbi +862 -0
  21. data/sorbet/rbi/gems/erubi@1.11.0.rbi +102 -0
  22. data/sorbet/rbi/gems/faraday-em_http@1.0.0.rbi +266 -0
  23. data/sorbet/rbi/gems/faraday-em_synchrony@1.0.0.rbi +209 -0
  24. data/sorbet/rbi/gems/faraday-excon@1.1.0.rbi +212 -0
  25. data/sorbet/rbi/gems/faraday-http-cache@2.4.1.rbi +805 -0
  26. data/sorbet/rbi/gems/faraday-httpclient@1.0.1.rbi +221 -0
  27. data/sorbet/rbi/gems/faraday-multipart@1.0.4.rbi +266 -0
  28. data/sorbet/rbi/gems/faraday-net_http@1.0.1.rbi +216 -0
  29. data/sorbet/rbi/gems/faraday-net_http_persistent@1.2.0.rbi +206 -0
  30. data/sorbet/rbi/gems/faraday-patron@1.0.0.rbi +212 -0
  31. data/sorbet/rbi/gems/faraday-rack@1.0.0.rbi +225 -0
  32. data/sorbet/rbi/gems/faraday-retry@1.0.3.rbi +222 -0
  33. data/sorbet/rbi/gems/faraday@1.10.2.rbi +1862 -0
  34. data/sorbet/rbi/gems/git@1.12.0.rbi +1936 -0
  35. data/sorbet/rbi/gems/i18n@1.12.0.rbi +1643 -0
  36. data/sorbet/rbi/gems/json@2.6.2.rbi +1418 -0
  37. data/sorbet/rbi/gems/kramdown-parser-gfm@1.1.0.rbi +8 -0
  38. data/sorbet/rbi/gems/kramdown@2.4.0.rbi +2168 -0
  39. data/sorbet/rbi/gems/loofah@2.19.0.rbi +646 -0
  40. data/sorbet/rbi/gems/method_source@1.0.0.rbi +199 -0
  41. data/sorbet/rbi/gems/minitest@5.16.3.rbi +997 -0
  42. data/sorbet/rbi/gems/multipart-post@2.2.3.rbi +165 -0
  43. data/sorbet/rbi/gems/nap@1.1.0.rbi +351 -0
  44. data/sorbet/rbi/gems/no_proxy_fix@0.1.2.rbi +8 -0
  45. data/sorbet/rbi/gems/nokogiri@1.13.8.rbi +4916 -0
  46. data/sorbet/rbi/gems/octokit@5.6.1.rbi +8939 -0
  47. data/sorbet/rbi/gems/open4@1.3.4.rbi +8 -0
  48. data/sorbet/rbi/gems/{packwerk@2.1.1.rbi → packwerk@2.2.1.rbi} +602 -51
  49. data/sorbet/rbi/gems/parallel@1.22.1.rbi +163 -0
  50. data/sorbet/rbi/gems/parser@3.1.2.1.rbi +5988 -0
  51. data/sorbet/rbi/gems/pry@0.14.1.rbi +6969 -0
  52. data/sorbet/rbi/gems/public_suffix@5.0.0.rbi +779 -0
  53. data/sorbet/rbi/gems/racc@1.6.0.rbi +92 -0
  54. data/sorbet/rbi/gems/rails-dom-testing@2.0.3.rbi +8 -0
  55. data/sorbet/rbi/gems/rails-html-sanitizer@1.4.3.rbi +493 -0
  56. data/sorbet/rbi/gems/rainbow@3.1.1.rbi +227 -0
  57. data/sorbet/rbi/gems/rake@13.0.6.rbi +1865 -0
  58. data/sorbet/rbi/gems/rbi@0.0.14.rbi +2337 -0
  59. data/sorbet/rbi/gems/rchardet@1.8.0.rbi +587 -0
  60. data/sorbet/rbi/gems/regexp_parser@2.5.0.rbi +1851 -0
  61. data/sorbet/rbi/gems/rexml@3.2.5.rbi +3852 -0
  62. data/sorbet/rbi/gems/rspec-core@3.11.0.rbi +7725 -0
  63. data/sorbet/rbi/gems/rspec-expectations@3.11.0.rbi +6201 -0
  64. data/sorbet/rbi/gems/rspec-mocks@3.11.1.rbi +3625 -0
  65. data/sorbet/rbi/gems/rspec-support@3.11.0.rbi +1176 -0
  66. data/sorbet/rbi/gems/rspec@3.11.0.rbi +40 -0
  67. data/sorbet/rbi/gems/rubocop-ast@1.21.0.rbi +4193 -0
  68. data/sorbet/rbi/gems/rubocop-sorbet@0.6.8.rbi +677 -0
  69. data/sorbet/rbi/gems/rubocop@1.36.0.rbi +37914 -0
  70. data/sorbet/rbi/gems/ruby-progressbar@1.11.0.rbi +732 -0
  71. data/sorbet/rbi/gems/ruby2_keywords@0.0.5.rbi +8 -0
  72. data/sorbet/rbi/gems/sawyer@0.9.2.rbi +513 -0
  73. data/sorbet/rbi/gems/smart_properties@1.17.0.rbi +326 -0
  74. data/sorbet/rbi/gems/spoom@1.1.11.rbi +1600 -0
  75. data/sorbet/rbi/gems/tapioca@0.8.0.rbi +1959 -0
  76. data/sorbet/rbi/gems/terminal-table@3.0.2.rbi +438 -0
  77. data/sorbet/rbi/gems/thor@1.2.1.rbi +2921 -0
  78. data/sorbet/rbi/gems/tzinfo@2.0.5.rbi +4879 -0
  79. data/sorbet/rbi/gems/unicode-display_width@2.3.0.rbi +27 -0
  80. data/sorbet/rbi/gems/unparser@0.6.5.rbi +2789 -0
  81. data/sorbet/rbi/gems/webrick@1.7.0.rbi +1802 -0
  82. data/sorbet/rbi/gems/yard-sorbet@0.6.1.rbi +288 -0
  83. data/sorbet/rbi/gems/yard@0.9.27.rbi +12668 -0
  84. data/sorbet/rbi/todo.rbi +122 -0
  85. metadata +84 -7
  86. data/sorbet/rbi/gems/danger@8.5.0.rbi +0 -122
@@ -0,0 +1,3625 @@
1
+ # typed: true
2
+
3
+ # DO NOT EDIT MANUALLY
4
+ # This is an autogenerated file for types exported from the `rspec-mocks` gem.
5
+ # Please instead update this file by running `bin/tapioca gem rspec-mocks`.
6
+
7
+ # Share the top-level RSpec namespace, because we are a core supported
8
+ # extension.
9
+ module RSpec
10
+ extend ::RSpec::Support::Warnings
11
+ extend ::RSpec::Core::Warnings
12
+
13
+ class << self
14
+ # Used to ensure examples get reloaded between multiple runs in the same
15
+ # process and ensures user configuration is persisted.
16
+ #
17
+ # Users must invoke this if they want to clear all examples but preserve
18
+ # current configuration when they use the runner multiple times within the
19
+ # same process.
20
+ def clear_examples; end
21
+
22
+ # Returns the global [Configuration](RSpec/Core/Configuration) object. While
23
+ # you _can_ use this method to access the configuration, the more common
24
+ # convention is to use [RSpec.configure](RSpec#configure-class_method).
25
+ #
26
+ # @example
27
+ # RSpec.configuration.drb_port = 1234
28
+ # @see RSpec.configure
29
+ # @see Core::Configuration
30
+ def configuration; end
31
+
32
+ # Setters for shared global objects
33
+ #
34
+ # @api private
35
+ def configuration=(_arg0); end
36
+
37
+ # Yields the global configuration to a block.
38
+ #
39
+ # @example
40
+ # RSpec.configure do |config|
41
+ # config.add_formatter 'documentation'
42
+ # end
43
+ # @see Core::Configuration
44
+ # @yield [Configuration] global configuration
45
+ def configure; end
46
+
47
+ # @private
48
+ def const_missing(name); end
49
+
50
+ def context(*args, &example_group_block); end
51
+
52
+ # The example being executed.
53
+ #
54
+ # The primary audience for this method is library authors who need access
55
+ # to the example currently being executed and also want to support all
56
+ # versions of RSpec 2 and 3.
57
+ #
58
+ # @example
59
+ #
60
+ # RSpec.configure do |c|
61
+ # # context.example is deprecated, but RSpec.current_example is not
62
+ # # available until RSpec 3.0.
63
+ # fetch_current_example = RSpec.respond_to?(:current_example) ?
64
+ # proc { RSpec.current_example } : proc { |context| context.example }
65
+ #
66
+ # c.before(:example) do
67
+ # example = fetch_current_example.call(self)
68
+ #
69
+ # # ...
70
+ # end
71
+ # end
72
+ def current_example; end
73
+
74
+ # Set the current example being executed.
75
+ #
76
+ # @api private
77
+ def current_example=(example); end
78
+
79
+ # Get the current RSpec execution scope
80
+ #
81
+ # Returns (in order of lifecycle):
82
+ # * `:suite` as an initial value, this is outside of the test lifecycle.
83
+ # * `:before_suite_hook` during `before(:suite)` hooks.
84
+ # * `:before_context_hook` during `before(:context)` hooks.
85
+ # * `:before_example_hook` during `before(:example)` hooks and `around(:example)` before `example.run`.
86
+ # * `:example` within the example run.
87
+ # * `:after_example_hook` during `after(:example)` hooks and `around(:example)` after `example.run`.
88
+ # * `:after_context_hook` during `after(:context)` hooks.
89
+ # * `:after_suite_hook` during `after(:suite)` hooks.
90
+ # * `:suite` as a final value, again this is outside of the test lifecycle.
91
+ #
92
+ # Reminder, `:context` hooks have `:all` alias and `:example` hooks have `:each` alias.
93
+ #
94
+ # @return [Symbol]
95
+ def current_scope; end
96
+
97
+ # Set the current scope rspec is executing in
98
+ #
99
+ # @api private
100
+ def current_scope=(scope); end
101
+
102
+ def describe(*args, &example_group_block); end
103
+ def example_group(*args, &example_group_block); end
104
+ def fcontext(*args, &example_group_block); end
105
+ def fdescribe(*args, &example_group_block); end
106
+
107
+ # Used to ensure examples get reloaded and user configuration gets reset to
108
+ # defaults between multiple runs in the same process.
109
+ #
110
+ # Users must invoke this if they want to have the configuration reset when
111
+ # they use the runner multiple times within the same process. Users must deal
112
+ # themselves with re-configuration of RSpec before run.
113
+ def reset; end
114
+
115
+ def shared_context(name, *args, &block); end
116
+ def shared_examples(name, *args, &block); end
117
+ def shared_examples_for(name, *args, &block); end
118
+
119
+ # Internal container for global non-configuration data.
120
+ #
121
+ # @private
122
+ def world; end
123
+
124
+ # Setters for shared global objects
125
+ #
126
+ # @api private
127
+ def world=(_arg0); end
128
+
129
+ def xcontext(*args, &example_group_block); end
130
+ def xdescribe(*args, &example_group_block); end
131
+ end
132
+ end
133
+
134
+ # @private
135
+ RSpec::MODULES_TO_AUTOLOAD = T.let(T.unsafe(nil), Hash)
136
+
137
+ # Contains top-level utility methods. While this contains a few
138
+ # public methods, these are not generally meant to be called from
139
+ # a test or example. They exist primarily for integration with
140
+ # test frameworks (such as rspec-core).
141
+ module RSpec::Mocks
142
+ class << self
143
+ # Adds an allowance (stub) on `subject`
144
+ #
145
+ # @example Defines the implementation of `foo` on `bar`, using the passed block
146
+ # x = 0
147
+ # RSpec::Mocks.allow_message(bar, :foo) { x += 1 }
148
+ # @param subject the subject to which the message will be added
149
+ # @param message a symbol, representing the message that will be
150
+ # added.
151
+ # @param opts a hash of options, :expected_from is used to set the
152
+ # original call site
153
+ # @yield an optional implementation for the allowance
154
+ def allow_message(subject, message, opts = T.unsafe(nil), &block); end
155
+
156
+ # Mocks specific configuration, as distinct from `RSpec.configuration`
157
+ # which is core RSpec configuration.
158
+ def configuration; end
159
+
160
+ # @private
161
+ def error_generator; end
162
+
163
+ # Sets a message expectation on `subject`.
164
+ #
165
+ # @example Expect the message `foo` to receive `bar`, then call it
166
+ # RSpec::Mocks.expect_message(bar, :foo)
167
+ # bar.foo
168
+ # @param subject the subject on which the message will be expected
169
+ # @param message a symbol, representing the message that will be
170
+ # expected.
171
+ # @param opts a hash of options, :expected_from is used to set the
172
+ # original call site
173
+ # @yield an optional implementation for the expectation
174
+ def expect_message(subject, message, opts = T.unsafe(nil), &block); end
175
+
176
+ # Performs per-test/example setup. This should be called before
177
+ # an test or example begins.
178
+ def setup; end
179
+
180
+ # @private
181
+ def space; end
182
+
183
+ # Cleans up all test double state (including any methods that were
184
+ # redefined on partial doubles). This _must_ be called after
185
+ # each example, even if an error was raised during the example.
186
+ def teardown; end
187
+
188
+ # Verifies any message expectations that were set during the
189
+ # test or example. This should be called at the end of an example.
190
+ def verify; end
191
+
192
+ # Call the passed block and verify mocks after it has executed. This allows
193
+ # mock usage in arbitrary places, such as a `before(:all)` hook.
194
+ #
195
+ # @return [Object] the return value from the block
196
+ def with_temporary_scope; end
197
+ end
198
+ end
199
+
200
+ # @private
201
+ class RSpec::Mocks::AllowanceTarget < ::RSpec::Mocks::TargetBase
202
+ def expression; end
203
+ def not_to(matcher, *_args); end
204
+ def to(matcher, &block); end
205
+ def to_not(matcher, *_args); end
206
+ end
207
+
208
+ # Handles the implementation of an `and_invoke` implementation.
209
+ #
210
+ # @private
211
+ class RSpec::Mocks::AndInvokeImplementation
212
+ # @return [AndInvokeImplementation] a new instance of AndInvokeImplementation
213
+ def initialize(procs_to_invoke); end
214
+
215
+ def call(*args, &block); end
216
+ end
217
+
218
+ # Handles the implementation of an `and_return` implementation.
219
+ #
220
+ # @private
221
+ class RSpec::Mocks::AndReturnImplementation
222
+ # @return [AndReturnImplementation] a new instance of AndReturnImplementation
223
+ def initialize(values_to_return); end
224
+
225
+ def call(*_args_to_ignore, &_block); end
226
+ end
227
+
228
+ # Represents an `and_call_original` implementation.
229
+ #
230
+ # @private
231
+ class RSpec::Mocks::AndWrapOriginalImplementation
232
+ # @return [AndWrapOriginalImplementation] a new instance of AndWrapOriginalImplementation
233
+ def initialize(method, block); end
234
+
235
+ def call(*args, &block); end
236
+ def initial_action=(_value); end
237
+ def inner_action; end
238
+ def inner_action=(_value); end
239
+
240
+ # @return [Boolean]
241
+ def present?; end
242
+
243
+ def terminal_action=(_value); end
244
+
245
+ private
246
+
247
+ def cannot_modify_further_error; end
248
+ end
249
+
250
+ class RSpec::Mocks::AndWrapOriginalImplementation::CannotModifyFurtherError < ::StandardError; end
251
+
252
+ # Handles the implementation of an `and_yield` declaration.
253
+ #
254
+ # @private
255
+ class RSpec::Mocks::AndYieldImplementation
256
+ # @return [AndYieldImplementation] a new instance of AndYieldImplementation
257
+ def initialize(args_to_yield, eval_context, error_generator); end
258
+
259
+ def call(*_args_to_ignore, &block); end
260
+ end
261
+
262
+ # @private
263
+ module RSpec::Mocks::AnyInstance
264
+ class << self
265
+ def error_generator; end
266
+ end
267
+ end
268
+
269
+ # @private
270
+ class RSpec::Mocks::AnyInstance::Chain
271
+ include ::RSpec::Mocks::AnyInstance::Chain::Customizations
272
+
273
+ # @return [Chain] a new instance of Chain
274
+ def initialize(recorder, *args, &block); end
275
+
276
+ # @private
277
+ # @return [Boolean]
278
+ def constrained_to_any_of?(*constraints); end
279
+
280
+ # @private
281
+ def expectation_fulfilled!; end
282
+
283
+ # @private
284
+ # @return [Boolean]
285
+ def matches_args?(*args); end
286
+
287
+ def never; end
288
+
289
+ # @private
290
+ def playback!(instance); end
291
+
292
+ def with(*args, &block); end
293
+
294
+ private
295
+
296
+ def last_message; end
297
+ def messages; end
298
+
299
+ # @return [Boolean]
300
+ def negated?; end
301
+
302
+ def record(rspec_method_name, *args, &block); end
303
+ end
304
+
305
+ # Provides convenience methods for recording customizations on message
306
+ # expectations.
307
+ #
308
+ # @private
309
+ module RSpec::Mocks::AnyInstance::Chain::Customizations
310
+ # Records the `and_call_original` message for playback against an instance that
311
+ # invokes a method stubbed or mocked using `any_instance`.
312
+ #
313
+ # @see RSpec::Mocks::MessageExpectation#and_call_original
314
+ def and_call_original(*args, &block); end
315
+
316
+ # Records the `and_raise` message for playback against an instance that
317
+ # invokes a method stubbed or mocked using `any_instance`.
318
+ #
319
+ # @see RSpec::Mocks::MessageExpectation#and_raise
320
+ def and_raise(*args, &block); end
321
+
322
+ # Records the `and_return` message for playback against an instance that
323
+ # invokes a method stubbed or mocked using `any_instance`.
324
+ #
325
+ # @see RSpec::Mocks::MessageExpectation#and_return
326
+ def and_return(*args, &block); end
327
+
328
+ # Records the `and_throw` message for playback against an instance that
329
+ # invokes a method stubbed or mocked using `any_instance`.
330
+ #
331
+ # @see RSpec::Mocks::MessageExpectation#and_throw
332
+ def and_throw(*args, &block); end
333
+
334
+ # Records the `and_wrap_original` message for playback against an instance that
335
+ # invokes a method stubbed or mocked using `any_instance`.
336
+ #
337
+ # @see RSpec::Mocks::MessageExpectation#and_wrap_original
338
+ def and_wrap_original(*args, &block); end
339
+
340
+ # Records the `and_yield` message for playback against an instance that
341
+ # invokes a method stubbed or mocked using `any_instance`.
342
+ #
343
+ # @see RSpec::Mocks::MessageExpectation#and_yield
344
+ def and_yield(*args, &block); end
345
+
346
+ # Records the `at_least` message for playback against an instance that
347
+ # invokes a method stubbed or mocked using `any_instance`.
348
+ #
349
+ # @see RSpec::Mocks::MessageExpectation#at_least
350
+ def at_least(*args, &block); end
351
+
352
+ # Records the `at_most` message for playback against an instance that
353
+ # invokes a method stubbed or mocked using `any_instance`.
354
+ #
355
+ # @see RSpec::Mocks::MessageExpectation#at_most
356
+ def at_most(*args, &block); end
357
+
358
+ # Records the `exactly` message for playback against an instance that
359
+ # invokes a method stubbed or mocked using `any_instance`.
360
+ #
361
+ # @see RSpec::Mocks::MessageExpectation#exactly
362
+ def exactly(*args, &block); end
363
+
364
+ # Records the `never` message for playback against an instance that
365
+ # invokes a method stubbed or mocked using `any_instance`.
366
+ #
367
+ # @see RSpec::Mocks::MessageExpectation#never
368
+ def never(*args, &block); end
369
+
370
+ # Records the `once` message for playback against an instance that
371
+ # invokes a method stubbed or mocked using `any_instance`.
372
+ #
373
+ # @see RSpec::Mocks::MessageExpectation#once
374
+ def once(*args, &block); end
375
+
376
+ # Records the `thrice` message for playback against an instance that
377
+ # invokes a method stubbed or mocked using `any_instance`.
378
+ #
379
+ # @see RSpec::Mocks::MessageExpectation#thrice
380
+ def thrice(*args, &block); end
381
+
382
+ # Records the `time` message for playback against an instance that
383
+ # invokes a method stubbed or mocked using `any_instance`.
384
+ #
385
+ # @see RSpec::Mocks::MessageExpectation#time
386
+ def time(*args, &block); end
387
+
388
+ # Records the `times` message for playback against an instance that
389
+ # invokes a method stubbed or mocked using `any_instance`.
390
+ #
391
+ # @see RSpec::Mocks::MessageExpectation#times
392
+ def times(*args, &block); end
393
+
394
+ # Records the `twice` message for playback against an instance that
395
+ # invokes a method stubbed or mocked using `any_instance`.
396
+ #
397
+ # @see RSpec::Mocks::MessageExpectation#twice
398
+ def twice(*args, &block); end
399
+
400
+ # Records the `with` message for playback against an instance that
401
+ # invokes a method stubbed or mocked using `any_instance`.
402
+ #
403
+ # @see RSpec::Mocks::MessageExpectation#with
404
+ def with(*args, &block); end
405
+
406
+ class << self
407
+ def record(method_name); end
408
+ end
409
+ end
410
+
411
+ # @private
412
+ class RSpec::Mocks::AnyInstance::ErrorGenerator < ::RSpec::Mocks::ErrorGenerator
413
+ def raise_does_not_implement_error(klass, method_name); end
414
+ def raise_message_already_received_by_other_instance_error(method_name, object_inspect, invoked_instance); end
415
+ def raise_not_supported_with_prepend_error(method_name, problem_mod); end
416
+ def raise_second_instance_received_message_error(unfulfilled_expectations); end
417
+ end
418
+
419
+ # @private
420
+ class RSpec::Mocks::AnyInstance::ExpectChainChain < ::RSpec::Mocks::AnyInstance::StubChain
421
+ # @return [ExpectChainChain] a new instance of ExpectChainChain
422
+ def initialize(*args); end
423
+
424
+ # @return [Boolean]
425
+ def expectation_fulfilled?; end
426
+
427
+ def playback!(instance); end
428
+
429
+ private
430
+
431
+ def create_message_expectation_on(instance); end
432
+ def invocation_order; end
433
+ end
434
+
435
+ # @private
436
+ class RSpec::Mocks::AnyInstance::ExpectationChain < ::RSpec::Mocks::AnyInstance::Chain
437
+ # @return [ExpectationChain] a new instance of ExpectationChain
438
+ def initialize(*args, &block); end
439
+
440
+ # @return [Boolean]
441
+ def expectation_fulfilled?; end
442
+
443
+ private
444
+
445
+ def verify_invocation_order(_rspec_method_name, *_args, &_block); end
446
+ end
447
+
448
+ # Delegates messages to each of the given targets in order to
449
+ # provide the fluent interface that is available off of message
450
+ # expectations when dealing with `any_instance`.
451
+ #
452
+ # `targets` will typically contain 1 of the `AnyInstance::Recorder`
453
+ # return values and N `MessageExpectation` instances (one per instance
454
+ # of the `any_instance` klass).
455
+ #
456
+ # @private
457
+ class RSpec::Mocks::AnyInstance::FluentInterfaceProxy
458
+ # @return [FluentInterfaceProxy] a new instance of FluentInterfaceProxy
459
+ def initialize(targets); end
460
+
461
+ def method_missing(*args, &block); end
462
+
463
+ private
464
+
465
+ # @return [Boolean]
466
+ def respond_to_missing?(method_name, include_private = T.unsafe(nil)); end
467
+ end
468
+
469
+ # @private
470
+ class RSpec::Mocks::AnyInstance::MessageChains
471
+ # @return [MessageChains] a new instance of MessageChains
472
+ def initialize; end
473
+
474
+ # @private
475
+ def [](method_name); end
476
+
477
+ # @private
478
+ def add(method_name, chain); end
479
+
480
+ # @private
481
+ # @return [Boolean]
482
+ def all_expectations_fulfilled?; end
483
+
484
+ # @private
485
+ def each_unfulfilled_expectation_matching(method_name, *args); end
486
+
487
+ # @private
488
+ # @return [Boolean]
489
+ def has_expectation?(method_name); end
490
+
491
+ # @private
492
+ def playback!(instance, method_name); end
493
+
494
+ # @private
495
+ def received_expected_message!(method_name); end
496
+
497
+ # @private
498
+ def remove_stub_chains_for!(method_name); end
499
+
500
+ # @private
501
+ def unfulfilled_expectations; end
502
+
503
+ private
504
+
505
+ def raise_if_second_instance_to_receive_message(instance); end
506
+ end
507
+
508
+ # @private
509
+ class RSpec::Mocks::AnyInstance::PositiveExpectationChain < ::RSpec::Mocks::AnyInstance::ExpectationChain
510
+ private
511
+
512
+ def create_message_expectation_on(instance); end
513
+ def invocation_order; end
514
+ end
515
+
516
+ RSpec::Mocks::AnyInstance::PositiveExpectationChain::ExpectationInvocationOrder = T.let(T.unsafe(nil), Hash)
517
+
518
+ # The `AnyInstance::Recorder` is responsible for redefining the klass's
519
+ # instance method in order to add any stubs/expectations the first time
520
+ # the method is called. It's not capable of updating a stub on an instance
521
+ # that's already been previously stubbed (either directly, or via
522
+ # `any_instance`).
523
+ #
524
+ # This proxy sits in front of the recorder and delegates both to it
525
+ # and to the `RSpec::Mocks::Proxy` for each already mocked or stubbed
526
+ # instance of the class, in order to propogates changes to the instances.
527
+ #
528
+ # Note that unlike `RSpec::Mocks::Proxy`, this proxy class is stateless
529
+ # and is not persisted in `RSpec::Mocks.space`.
530
+ #
531
+ # Proxying for the message expectation fluent interface (typically chained
532
+ # off of the return value of one of these methods) is provided by the
533
+ # `FluentInterfaceProxy` class below.
534
+ #
535
+ # @private
536
+ class RSpec::Mocks::AnyInstance::Proxy
537
+ # @return [Proxy] a new instance of Proxy
538
+ def initialize(recorder, target_proxies); end
539
+
540
+ def expect_chain(*chain, &block); end
541
+ def klass; end
542
+ def should_not_receive(method_name, &block); end
543
+ def should_receive(method_name, &block); end
544
+ def stub(method_name_or_method_map, &block); end
545
+ def stub_chain(*chain, &block); end
546
+ def unstub(method_name); end
547
+
548
+ private
549
+
550
+ def perform_proxying(method_name, args, block, &target_proxy_block); end
551
+ end
552
+
553
+ # Given a class `TheClass`, `TheClass.any_instance` returns a `Recorder`,
554
+ # which records stubs and message expectations for later playback on
555
+ # instances of `TheClass`.
556
+ #
557
+ # Further constraints are stored in instances of [Chain](Chain).
558
+ #
559
+ # @see AnyInstance
560
+ # @see Chain
561
+ class RSpec::Mocks::AnyInstance::Recorder
562
+ # @return [Recorder] a new instance of Recorder
563
+ def initialize(klass); end
564
+
565
+ # @private
566
+ # @return [Boolean]
567
+ def already_observing?(method_name); end
568
+
569
+ # @private
570
+ def build_alias_method_name(method_name); end
571
+
572
+ # @private
573
+ def expect_chain(*method_names_and_optional_return_values, &block); end
574
+
575
+ # @private
576
+ def instance_that_received(method_name); end
577
+
578
+ # @private
579
+ def klass; end
580
+
581
+ # @private
582
+ def message_chains; end
583
+
584
+ # @private
585
+ def notify_received_message(_object, message, args, _blk); end
586
+
587
+ # @private
588
+ def playback!(instance, method_name); end
589
+
590
+ # The opposite of `should_receive`
591
+ #
592
+ # @see Methods#should_not_receive
593
+ def should_not_receive(method_name, &block); end
594
+
595
+ # Initializes the recording a message expectation to be played back
596
+ # against any instance of this object that invokes the submitted
597
+ # method.
598
+ #
599
+ # @see Methods#should_receive
600
+ def should_receive(method_name, &block); end
601
+
602
+ # @private
603
+ def stop_all_observation!; end
604
+
605
+ # Initializes the recording a stub to be played back against any
606
+ # instance of this object that invokes the submitted method.
607
+ #
608
+ # @see Methods#stub
609
+ def stub(method_name, &block); end
610
+
611
+ # Initializes the recording a stub chain to be played back against any
612
+ # instance of this object that invokes the method matching the first
613
+ # argument.
614
+ #
615
+ # @see Methods#stub_chain
616
+ def stub_chain(*method_names_and_optional_return_values, &block); end
617
+
618
+ # @private
619
+ def stubs; end
620
+
621
+ # Removes any previously recorded stubs, stub_chains or message
622
+ # expectations that use `method_name`.
623
+ #
624
+ # @see Methods#unstub
625
+ def unstub(method_name); end
626
+
627
+ # Used internally to verify that message expectations have been
628
+ # fulfilled.
629
+ #
630
+ # @api private
631
+ def verify; end
632
+
633
+ protected
634
+
635
+ def stop_observing!(method_name); end
636
+
637
+ private
638
+
639
+ def allow_no_prepended_module_definition_of(method_name); end
640
+
641
+ # @return [Boolean]
642
+ def ancestor_is_an_observer?(method_name); end
643
+
644
+ def backup_method!(method_name); end
645
+ def mark_invoked!(method_name); end
646
+
647
+ # @yield [args.first, args]
648
+ def normalize_chain(*args); end
649
+
650
+ def observe!(method_name); end
651
+
652
+ # @return [Boolean]
653
+ def public_protected_or_private_method_defined?(method_name); end
654
+
655
+ def received_expected_message!(method_name); end
656
+ def remove_dummy_method!(method_name); end
657
+ def restore_method!(method_name); end
658
+ def restore_original_method!(method_name); end
659
+ def super_class_observers_for(method_name); end
660
+
661
+ # @return [Boolean]
662
+ def super_class_observing?(method_name); end
663
+ end
664
+
665
+ # @private
666
+ class RSpec::Mocks::AnyInstance::StubChain < ::RSpec::Mocks::AnyInstance::Chain
667
+ # @private
668
+ # @return [Boolean]
669
+ def expectation_fulfilled?; end
670
+
671
+ private
672
+
673
+ def create_message_expectation_on(instance); end
674
+ def invocation_order; end
675
+
676
+ # @raise [NoMethodError]
677
+ def verify_invocation_order(rspec_method_name, *_args, &_block); end
678
+ end
679
+
680
+ RSpec::Mocks::AnyInstance::StubChain::EmptyInvocationOrder = T.let(T.unsafe(nil), Hash)
681
+ RSpec::Mocks::AnyInstance::StubChain::InvocationOrder = T.let(T.unsafe(nil), Hash)
682
+
683
+ # @private
684
+ class RSpec::Mocks::AnyInstance::StubChainChain < ::RSpec::Mocks::AnyInstance::StubChain
685
+ # @return [StubChainChain] a new instance of StubChainChain
686
+ def initialize(*args); end
687
+
688
+ private
689
+
690
+ def create_message_expectation_on(instance); end
691
+ def invocation_order; end
692
+ end
693
+
694
+ # @private
695
+ class RSpec::Mocks::AnyInstanceAllowanceTarget < ::RSpec::Mocks::TargetBase
696
+ def expression; end
697
+ def not_to(matcher, *_args); end
698
+ def to(matcher, &block); end
699
+ def to_not(matcher, *_args); end
700
+ end
701
+
702
+ # @private
703
+ class RSpec::Mocks::AnyInstanceExpectationTarget < ::RSpec::Mocks::TargetBase
704
+ def expression; end
705
+ def not_to(matcher, &block); end
706
+ def to(matcher, &block); end
707
+ def to_not(matcher, &block); end
708
+ end
709
+
710
+ # Wrapper for matching arguments against a list of expected values. Used by
711
+ # the `with` method on a `MessageExpectation`:
712
+ #
713
+ # expect(object).to receive(:message).with(:a, 'b', 3)
714
+ # object.message(:a, 'b', 3)
715
+ #
716
+ # Values passed to `with` can be literal values or argument matchers that
717
+ # match against the real objects .e.g.
718
+ #
719
+ # expect(object).to receive(:message).with(hash_including(:a => 'b'))
720
+ #
721
+ # Can also be used directly to match the contents of any `Array`. This
722
+ # enables 3rd party mocking libs to take advantage of rspec's argument
723
+ # matching without using the rest of rspec-mocks.
724
+ #
725
+ # require 'rspec/mocks/argument_list_matcher'
726
+ # include RSpec::Mocks::ArgumentMatchers
727
+ #
728
+ # arg_list_matcher = RSpec::Mocks::ArgumentListMatcher.new(123, hash_including(:a => 'b'))
729
+ # arg_list_matcher.args_match?(123, :a => 'b')
730
+ #
731
+ # This class is immutable.
732
+ #
733
+ # @see ArgumentMatchers
734
+ class RSpec::Mocks::ArgumentListMatcher
735
+ # Initializes an `ArgumentListMatcher` with a collection of literal
736
+ # values and/or argument matchers.
737
+ #
738
+ # @api public
739
+ # @param expected_args [Array] a list of expected literals and/or argument matchers
740
+ # @return [ArgumentListMatcher] a new instance of ArgumentListMatcher
741
+ # @see ArgumentMatchers
742
+ # @see #args_match?
743
+ def initialize(*expected_args); end
744
+
745
+ # Matches each element in the `expected_args` against the element in the same
746
+ # position of the arguments passed to `new`.
747
+ #
748
+ # @api public
749
+ # @param actual_args [Array]
750
+ # @return [Boolean]
751
+ # @see #initialize
752
+ def args_match?(*actual_args); end
753
+
754
+ # @private
755
+ def expected_args; end
756
+
757
+ # Resolves abstract arg placeholders like `no_args` and `any_args` into
758
+ # a more concrete arg list based on the provided `actual_args`.
759
+ #
760
+ # @private
761
+ def resolve_expected_args_based_on(actual_args); end
762
+
763
+ private
764
+
765
+ def ensure_expected_args_valid!; end
766
+ def replace_any_args_with_splat_of_anything(before_count, actual_args_count); end
767
+ end
768
+
769
+ # Value that will match all argument lists.
770
+ #
771
+ # @private
772
+ RSpec::Mocks::ArgumentListMatcher::MATCH_ALL = T.let(T.unsafe(nil), RSpec::Mocks::ArgumentListMatcher)
773
+
774
+ # ArgumentMatchers are placeholders that you can include in message
775
+ # expectations to match arguments against a broader check than simple
776
+ # equality.
777
+ #
778
+ # With the exception of `any_args` and `no_args`, they all match against
779
+ # the arg in same position in the argument list.
780
+ #
781
+ # @see ArgumentListMatcher
782
+ module RSpec::Mocks::ArgumentMatchers
783
+ # Matches if `arg.kind_of?(klass)`
784
+ #
785
+ # @example
786
+ # expect(object).to receive(:message).with(kind_of(Thing))
787
+ def a_kind_of(klass); end
788
+
789
+ # Matches if `arg.instance_of?(klass)`
790
+ #
791
+ # @example
792
+ # expect(object).to receive(:message).with(instance_of(Thing))
793
+ def an_instance_of(klass); end
794
+
795
+ # Acts like an arg splat, matching any number of args at any point in an arg list.
796
+ #
797
+ # @example
798
+ # expect(object).to receive(:message).with(1, 2, any_args)
799
+ #
800
+ # # matches any of these:
801
+ # object.message(1, 2)
802
+ # object.message(1, 2, 3)
803
+ # object.message(1, 2, 3, 4)
804
+ def any_args; end
805
+
806
+ # Matches any argument at all.
807
+ #
808
+ # @example
809
+ # expect(object).to receive(:message).with(anything)
810
+ def anything; end
811
+
812
+ # Matches an array that includes the specified items at least once.
813
+ # Ignores duplicates and additional values
814
+ #
815
+ # @example
816
+ # expect(object).to receive(:message).with(array_including(1,2,3))
817
+ # expect(object).to receive(:message).with(array_including([1,2,3]))
818
+ def array_including(*args); end
819
+
820
+ # Matches a boolean value.
821
+ #
822
+ # @example
823
+ # expect(object).to receive(:message).with(boolean())
824
+ def boolean; end
825
+
826
+ # Matches if the actual argument responds to the specified messages.
827
+ #
828
+ # @example
829
+ # expect(object).to receive(:message).with(duck_type(:hello))
830
+ # expect(object).to receive(:message).with(duck_type(:hello, :goodbye))
831
+ def duck_type(*args); end
832
+
833
+ # Matches a hash that doesn't include the specified key(s) or key/value.
834
+ #
835
+ # @example
836
+ # expect(object).to receive(:message).with(hash_excluding(:key => val))
837
+ # expect(object).to receive(:message).with(hash_excluding(:key))
838
+ # expect(object).to receive(:message).with(hash_excluding(:key, :key2 => :val2))
839
+ def hash_excluding(*args); end
840
+
841
+ # Matches a hash that includes the specified key(s) or key/value pairs.
842
+ # Ignores any additional keys.
843
+ #
844
+ # @example
845
+ # expect(object).to receive(:message).with(hash_including(:key => val))
846
+ # expect(object).to receive(:message).with(hash_including(:key))
847
+ # expect(object).to receive(:message).with(hash_including(:key, :key2 => val2))
848
+ def hash_including(*args); end
849
+
850
+ # Matches a hash that doesn't include the specified key(s) or key/value.
851
+ #
852
+ # @example
853
+ # expect(object).to receive(:message).with(hash_excluding(:key => val))
854
+ # expect(object).to receive(:message).with(hash_excluding(:key))
855
+ # expect(object).to receive(:message).with(hash_excluding(:key, :key2 => :val2))
856
+ def hash_not_including(*args); end
857
+
858
+ # Matches if `arg.instance_of?(klass)`
859
+ #
860
+ # @example
861
+ # expect(object).to receive(:message).with(instance_of(Thing))
862
+ def instance_of(klass); end
863
+
864
+ # Matches if `arg.kind_of?(klass)`
865
+ #
866
+ # @example
867
+ # expect(object).to receive(:message).with(kind_of(Thing))
868
+ def kind_of(klass); end
869
+
870
+ # Matches no arguments.
871
+ #
872
+ # @example
873
+ # expect(object).to receive(:message).with(no_args)
874
+ def no_args; end
875
+
876
+ class << self
877
+ # @private
878
+ def anythingize_lonely_keys(*args); end
879
+ end
880
+ end
881
+
882
+ # @private
883
+ class RSpec::Mocks::ArgumentMatchers::AnyArgMatcher < ::RSpec::Mocks::ArgumentMatchers::SingletonMatcher
884
+ def ===(_other); end
885
+ def description; end
886
+ end
887
+
888
+ RSpec::Mocks::ArgumentMatchers::AnyArgMatcher::INSTANCE = T.let(T.unsafe(nil), RSpec::Mocks::ArgumentMatchers::AnyArgMatcher)
889
+
890
+ # @private
891
+ class RSpec::Mocks::ArgumentMatchers::AnyArgsMatcher < ::RSpec::Mocks::ArgumentMatchers::SingletonMatcher
892
+ def description; end
893
+ end
894
+
895
+ RSpec::Mocks::ArgumentMatchers::AnyArgsMatcher::INSTANCE = T.let(T.unsafe(nil), RSpec::Mocks::ArgumentMatchers::AnyArgsMatcher)
896
+
897
+ # @private
898
+ class RSpec::Mocks::ArgumentMatchers::ArrayIncludingMatcher
899
+ # @return [ArrayIncludingMatcher] a new instance of ArrayIncludingMatcher
900
+ def initialize(expected); end
901
+
902
+ def ===(actual); end
903
+ def description; end
904
+
905
+ private
906
+
907
+ def formatted_expected_values; end
908
+ end
909
+
910
+ # @private
911
+ class RSpec::Mocks::ArgumentMatchers::BaseHashMatcher
912
+ # @return [BaseHashMatcher] a new instance of BaseHashMatcher
913
+ def initialize(expected); end
914
+
915
+ def ===(predicate, actual); end
916
+ def description(name); end
917
+
918
+ private
919
+
920
+ def formatted_expected_hash; end
921
+ end
922
+
923
+ # @private
924
+ class RSpec::Mocks::ArgumentMatchers::BooleanMatcher < ::RSpec::Mocks::ArgumentMatchers::SingletonMatcher
925
+ def ===(value); end
926
+ def description; end
927
+ end
928
+
929
+ RSpec::Mocks::ArgumentMatchers::BooleanMatcher::INSTANCE = T.let(T.unsafe(nil), RSpec::Mocks::ArgumentMatchers::BooleanMatcher)
930
+
931
+ # @private
932
+ class RSpec::Mocks::ArgumentMatchers::DuckTypeMatcher
933
+ # @return [DuckTypeMatcher] a new instance of DuckTypeMatcher
934
+ def initialize(*methods_to_respond_to); end
935
+
936
+ def ===(value); end
937
+ def description; end
938
+ end
939
+
940
+ # @private
941
+ class RSpec::Mocks::ArgumentMatchers::HashExcludingMatcher < ::RSpec::Mocks::ArgumentMatchers::BaseHashMatcher
942
+ def ===(actual); end
943
+ def description; end
944
+ end
945
+
946
+ # @private
947
+ class RSpec::Mocks::ArgumentMatchers::HashIncludingMatcher < ::RSpec::Mocks::ArgumentMatchers::BaseHashMatcher
948
+ def ===(actual); end
949
+ def description; end
950
+ end
951
+
952
+ # @private
953
+ class RSpec::Mocks::ArgumentMatchers::InstanceOf
954
+ # @return [InstanceOf] a new instance of InstanceOf
955
+ def initialize(klass); end
956
+
957
+ def ===(actual); end
958
+ def description; end
959
+ end
960
+
961
+ # @private
962
+ class RSpec::Mocks::ArgumentMatchers::KindOf
963
+ # @return [KindOf] a new instance of KindOf
964
+ def initialize(klass); end
965
+
966
+ def ===(actual); end
967
+ def description; end
968
+ end
969
+
970
+ # @private
971
+ class RSpec::Mocks::ArgumentMatchers::NoArgsMatcher < ::RSpec::Mocks::ArgumentMatchers::SingletonMatcher
972
+ def description; end
973
+ end
974
+
975
+ RSpec::Mocks::ArgumentMatchers::NoArgsMatcher::INSTANCE = T.let(T.unsafe(nil), RSpec::Mocks::ArgumentMatchers::NoArgsMatcher)
976
+
977
+ # Intended to be subclassed by stateless, immutable argument matchers.
978
+ # Provides a `<klass name>::INSTANCE` constant for accessing a global
979
+ # singleton instance of the matcher. There is no need to construct
980
+ # multiple instance since there is no state. It also facilities the
981
+ # special case logic we need for some of these matchers, by making it
982
+ # easy to do comparisons like: `[klass::INSTANCE] == args` rather than
983
+ # `args.count == 1 && klass === args.first`.
984
+ #
985
+ # @private
986
+ class RSpec::Mocks::ArgumentMatchers::SingletonMatcher
987
+ class << self
988
+ # @private
989
+ def inherited(subklass); end
990
+ end
991
+ end
992
+
993
+ # @private
994
+ class RSpec::Mocks::CallbackInvocationStrategy
995
+ def call(doubled_module); end
996
+ end
997
+
998
+ # Raised for situations that RSpec cannot support due to mutations made
999
+ # externally on arguments that RSpec is holding onto to use for later
1000
+ # comparisons.
1001
+ #
1002
+ # @deprecated We no longer raise this error but the constant remains until
1003
+ # RSpec 4 for SemVer reasons.
1004
+ class RSpec::Mocks::CannotSupportArgMutationsError < ::StandardError; end
1005
+
1006
+ # When a class's `.new` method is stubbed, we want to use the method
1007
+ # signature from `#initialize` because `.new`'s signature is a generic
1008
+ # `def new(*args)` and it simply delegates to `#initialize` and forwards
1009
+ # all args...so the method with the actually used signature is `#initialize`.
1010
+ #
1011
+ # This method reference implementation handles that specific case.
1012
+ #
1013
+ # @private
1014
+ class RSpec::Mocks::ClassNewMethodReference < ::RSpec::Mocks::ObjectMethodReference
1015
+ def with_signature; end
1016
+
1017
+ class << self
1018
+ # @return [Boolean]
1019
+ def applies_to?(method_name); end
1020
+ end
1021
+ end
1022
+
1023
+ # Effectively the same as an ObjectVerifyingDouble (since a class is a type
1024
+ # of object), except with Module in the inheritance chain so that
1025
+ # transferring nested constants to work.
1026
+ #
1027
+ # @private
1028
+ class RSpec::Mocks::ClassVerifyingDouble < ::Module
1029
+ include ::RSpec::Mocks::TestDouble
1030
+ include ::RSpec::Mocks::VerifyingDouble
1031
+ include ::RSpec::Mocks::ObjectVerifyingDoubleMethods
1032
+ end
1033
+
1034
+ # Provides configuration options for rspec-mocks.
1035
+ class RSpec::Mocks::Configuration
1036
+ # @return [Configuration] a new instance of Configuration
1037
+ def initialize; end
1038
+
1039
+ # Adds `stub` and `should_receive` to the given
1040
+ # modules or classes. This is usually only necessary
1041
+ # if you application uses some proxy classes that
1042
+ # "strip themselves down" to a bare minimum set of
1043
+ # methods and remove `stub` and `should_receive` in
1044
+ # the process.
1045
+ #
1046
+ # @example
1047
+ # RSpec.configure do |rspec|
1048
+ # rspec.mock_with :rspec do |mocks|
1049
+ # mocks.add_stub_and_should_receive_to Delegator
1050
+ # end
1051
+ # end
1052
+ def add_stub_and_should_receive_to(*modules); end
1053
+
1054
+ # Sets whether RSpec will warn, ignore, or fail a test when
1055
+ # expectations are set on nil.
1056
+ # By default, when this flag is not set, warning messages are issued when
1057
+ # expectations are set on nil. This is to prevent false-positives and to
1058
+ # catch potential bugs early on.
1059
+ # When set to `true`, warning messages are suppressed.
1060
+ # When set to `false`, it will raise an error.
1061
+ #
1062
+ # @example
1063
+ # RSpec.configure do |config|
1064
+ # config.mock_with :rspec do |mocks|
1065
+ # mocks.allow_message_expectations_on_nil = false
1066
+ # end
1067
+ # end
1068
+ def allow_message_expectations_on_nil; end
1069
+
1070
+ # Sets whether RSpec will warn, ignore, or fail a test when
1071
+ # expectations are set on nil.
1072
+ # By default, when this flag is not set, warning messages are issued when
1073
+ # expectations are set on nil. This is to prevent false-positives and to
1074
+ # catch potential bugs early on.
1075
+ # When set to `true`, warning messages are suppressed.
1076
+ # When set to `false`, it will raise an error.
1077
+ #
1078
+ # @example
1079
+ # RSpec.configure do |config|
1080
+ # config.mock_with :rspec do |mocks|
1081
+ # mocks.allow_message_expectations_on_nil = false
1082
+ # end
1083
+ # end
1084
+ def allow_message_expectations_on_nil=(_arg0); end
1085
+
1086
+ # Provides a way to perform customisations when verifying doubles.
1087
+ #
1088
+ # @example
1089
+ # RSpec::Mocks.configuration.before_verifying_doubles do |ref|
1090
+ # ref.some_method!
1091
+ # end
1092
+ def before_verifying_doubles(&block); end
1093
+
1094
+ # Indicates whether or not diffs should be colored.
1095
+ # Delegates to rspec-core's color option if rspec-core
1096
+ # is loaded; otherwise you can set it here.
1097
+ #
1098
+ # @return [Boolean]
1099
+ def color?; end
1100
+
1101
+ # Monkey-patch `Marshal.dump` to enable dumping of mocked or stubbed
1102
+ # objects. By default this will not work since RSpec mocks works by
1103
+ # adding singleton methods that cannot be serialized. This patch removes
1104
+ # these singleton methods before serialization. Setting to falsey removes
1105
+ # the patch.
1106
+ #
1107
+ # This method is idempotent.
1108
+ def patch_marshal_to_support_partial_doubles=(val); end
1109
+
1110
+ # Resets the configured syntax to the default.
1111
+ #
1112
+ # @api private
1113
+ def reset_syntaxes_to_default; end
1114
+
1115
+ # Returns an array with a list of syntaxes
1116
+ # that are enabled.
1117
+ #
1118
+ # @example
1119
+ # unless RSpec::Mocks.configuration.syntax.include?(:expect)
1120
+ # raise "this RSpec extension gem requires the rspec-mocks `:expect` syntax"
1121
+ # end
1122
+ def syntax; end
1123
+
1124
+ # Provides the ability to set either `expect`,
1125
+ # `should` or both syntaxes. RSpec uses `expect`
1126
+ # syntax by default. This is needed if you want to
1127
+ # explicitly enable `should` syntax and/or explicitly
1128
+ # disable `expect` syntax.
1129
+ #
1130
+ # end
1131
+ #
1132
+ # @example
1133
+ # RSpec.configure do |rspec|
1134
+ # rspec.mock_with :rspec do |mocks|
1135
+ # mocks.syntax = [:expect, :should]
1136
+ # end
1137
+ def syntax=(*values); end
1138
+
1139
+ # Used to track wether we are temporarily suppressing verifying partial
1140
+ # doubles with `without_partial_double_verification { ... }`
1141
+ #
1142
+ # @private
1143
+ def temporarily_suppress_partial_double_verification; end
1144
+
1145
+ # Used to track wether we are temporarily suppressing verifying partial
1146
+ # doubles with `without_partial_double_verification { ... }`
1147
+ #
1148
+ # @private
1149
+ def temporarily_suppress_partial_double_verification=(_arg0); end
1150
+
1151
+ # Sets the default for the `transfer_nested_constants` option when
1152
+ # stubbing constants.
1153
+ def transfer_nested_constants=(_arg0); end
1154
+
1155
+ # @return [Boolean]
1156
+ def transfer_nested_constants?; end
1157
+
1158
+ # When this is set to true, an error will be raised when
1159
+ # `instance_double` or `class_double` is given the name of an undefined
1160
+ # constant. You probably only want to set this when running your entire
1161
+ # test suite, with all production code loaded. Setting this for an
1162
+ # isolated unit test will prevent you from being able to isolate it!
1163
+ def verify_doubled_constant_names=(_arg0); end
1164
+
1165
+ # @return [Boolean]
1166
+ def verify_doubled_constant_names?; end
1167
+
1168
+ # When set to true, partial mocks will be verified the same as object
1169
+ # doubles. Any stubs will have their arguments checked against the original
1170
+ # method, and methods that do not exist cannot be stubbed.
1171
+ def verify_partial_doubles=(val); end
1172
+
1173
+ # @return [Boolean]
1174
+ def verify_partial_doubles?; end
1175
+
1176
+ # Returns an array of blocks to call when verifying doubles
1177
+ #
1178
+ # @api private
1179
+ def verifying_double_callbacks; end
1180
+
1181
+ # Provides a way to perform customisations when verifying doubles.
1182
+ #
1183
+ # @example
1184
+ # RSpec::Mocks.configuration.before_verifying_doubles do |ref|
1185
+ # ref.some_method!
1186
+ # end
1187
+ def when_declaring_verifying_double(&block); end
1188
+
1189
+ # Sets whether or not RSpec will yield the receiving instance of a
1190
+ # message to blocks that are used for any_instance stub implementations.
1191
+ # When set, the first yielded argument will be the receiving instance.
1192
+ # Defaults to `true`.
1193
+ #
1194
+ # @example
1195
+ # RSpec.configure do |rspec|
1196
+ # rspec.mock_with :rspec do |mocks|
1197
+ # mocks.yield_receiver_to_any_instance_implementation_blocks = false
1198
+ # end
1199
+ # end
1200
+ def yield_receiver_to_any_instance_implementation_blocks=(_arg0); end
1201
+
1202
+ # @return [Boolean]
1203
+ def yield_receiver_to_any_instance_implementation_blocks?; end
1204
+ end
1205
+
1206
+ # Provides information about constants that may (or may not)
1207
+ # have been mutated by rspec-mocks.
1208
+ class RSpec::Mocks::Constant
1209
+ extend ::RSpec::Support::RecursiveConstMethods
1210
+
1211
+ # @api private
1212
+ # @return [Constant] a new instance of Constant
1213
+ # @yield [_self]
1214
+ # @yieldparam _self [RSpec::Mocks::Constant] the object that the method was called on
1215
+ def initialize(name); end
1216
+
1217
+ # @private
1218
+ def hidden=(_arg0); end
1219
+
1220
+ # @return [Boolean] Whether or not rspec-mocks has hidden
1221
+ # this constant.
1222
+ def hidden?; end
1223
+
1224
+ # The default `to_s` isn't very useful, so a custom version is provided.
1225
+ def inspect; end
1226
+
1227
+ # @return [Boolean] Whether or not rspec-mocks has mutated
1228
+ # (stubbed or hidden) this constant.
1229
+ def mutated?; end
1230
+
1231
+ # @return [String] The fully qualified name of the constant.
1232
+ def name; end
1233
+
1234
+ # @return [Object, nil] The original value (e.g. before it
1235
+ # was mutated by rspec-mocks) of the constant, or
1236
+ # nil if the constant was not previously defined.
1237
+ def original_value; end
1238
+
1239
+ # @return [Object, nil] The original value (e.g. before it
1240
+ # was mutated by rspec-mocks) of the constant, or
1241
+ # nil if the constant was not previously defined.
1242
+ def original_value=(_arg0); end
1243
+
1244
+ # @private
1245
+ def previously_defined=(_arg0); end
1246
+
1247
+ # @return [Boolean] Whether or not the constant was defined
1248
+ # before the current example.
1249
+ def previously_defined?; end
1250
+
1251
+ # @private
1252
+ def stubbed=(_arg0); end
1253
+
1254
+ # @return [Boolean] Whether or not rspec-mocks has stubbed
1255
+ # this constant.
1256
+ def stubbed?; end
1257
+
1258
+ # The default `to_s` isn't very useful, so a custom version is provided.
1259
+ def to_s; end
1260
+
1261
+ # @private
1262
+ def valid_name=(_arg0); end
1263
+
1264
+ # @return [Boolean] Whether or not the provided constant name
1265
+ # is a valid Ruby constant name.
1266
+ def valid_name?; end
1267
+
1268
+ class << self
1269
+ # Queries rspec-mocks to find out information about the named constant.
1270
+ #
1271
+ # @param name [String] the name of the constant
1272
+ # @return [Constant] an object contaning information about the named
1273
+ # constant.
1274
+ def original(name); end
1275
+
1276
+ # @private
1277
+ def unmutated(name); end
1278
+ end
1279
+ end
1280
+
1281
+ # Provides a means to stub constants.
1282
+ class RSpec::Mocks::ConstantMutator
1283
+ extend ::RSpec::Support::RecursiveConstMethods
1284
+
1285
+ class << self
1286
+ # Hides a constant.
1287
+ #
1288
+ # @note It's recommended that you use `hide_const` in your
1289
+ # examples. This is an alternate public API that is provided
1290
+ # so you can hide constants in other contexts (e.g. helper
1291
+ # classes).
1292
+ # @param constant_name [String] The fully qualified name of the constant.
1293
+ # The current constant scoping at the point of call is not considered.
1294
+ # @see ExampleMethods#hide_const
1295
+ def hide(constant_name); end
1296
+
1297
+ # Uses the mutator to mutate (stub or hide) a constant. Ensures that
1298
+ # the mutator is correctly registered so it can be backed out at the end
1299
+ # of the test.
1300
+ #
1301
+ # @private
1302
+ def mutate(mutator); end
1303
+
1304
+ # Used internally by the constant stubbing to raise a helpful
1305
+ # error when a constant like "A::B::C" is stubbed and A::B is
1306
+ # not a module (and thus, it's impossible to define "A::B::C"
1307
+ # since only modules can have nested constants).
1308
+ #
1309
+ # @api private
1310
+ def raise_on_invalid_const; end
1311
+
1312
+ # Stubs a constant.
1313
+ #
1314
+ # @note It's recommended that you use `stub_const` in your
1315
+ # examples. This is an alternate public API that is provided
1316
+ # so you can stub constants in other contexts (e.g. helper
1317
+ # classes).
1318
+ # @option options
1319
+ # @param constant_name [String] The fully qualified name of the constant. The current
1320
+ # constant scoping at the point of call is not considered.
1321
+ # @param value [Object] The value to make the constant refer to. When the
1322
+ # example completes, the constant will be restored to its prior state.
1323
+ # @param options [Hash] Stubbing options.
1324
+ # @return [Object] the stubbed value of the constant
1325
+ # @see ExampleMethods#stub_const
1326
+ def stub(constant_name, value, options = T.unsafe(nil)); end
1327
+ end
1328
+ end
1329
+
1330
+ # Contains common functionality used by all of the constant mutators.
1331
+ #
1332
+ # @private
1333
+ class RSpec::Mocks::ConstantMutator::BaseMutator
1334
+ include ::RSpec::Support::RecursiveConstMethods
1335
+
1336
+ # @return [BaseMutator] a new instance of BaseMutator
1337
+ def initialize(full_constant_name, mutated_value, transfer_nested_constants); end
1338
+
1339
+ # Returns the value of attribute full_constant_name.
1340
+ def full_constant_name; end
1341
+
1342
+ def idempotently_reset; end
1343
+
1344
+ # Returns the value of attribute original_value.
1345
+ def original_value; end
1346
+
1347
+ def to_constant; end
1348
+ end
1349
+
1350
+ # Hides a defined constant for the duration of an example.
1351
+ #
1352
+ # @private
1353
+ class RSpec::Mocks::ConstantMutator::ConstantHider < ::RSpec::Mocks::ConstantMutator::BaseMutator
1354
+ def mutate; end
1355
+ def reset; end
1356
+ def to_constant; end
1357
+ end
1358
+
1359
+ # Replaces a defined constant for the duration of an example.
1360
+ #
1361
+ # @private
1362
+ class RSpec::Mocks::ConstantMutator::DefinedConstantReplacer < ::RSpec::Mocks::ConstantMutator::BaseMutator
1363
+ # @return [DefinedConstantReplacer] a new instance of DefinedConstantReplacer
1364
+ def initialize(*args); end
1365
+
1366
+ def mutate; end
1367
+ def reset; end
1368
+
1369
+ # @return [Boolean]
1370
+ def should_transfer_nested_constants?; end
1371
+
1372
+ def to_constant; end
1373
+ def transfer_nested_constants; end
1374
+ def verify_constants_to_transfer!; end
1375
+ end
1376
+
1377
+ # Sets an undefined constant for the duration of an example.
1378
+ #
1379
+ # @private
1380
+ class RSpec::Mocks::ConstantMutator::UndefinedConstantSetter < ::RSpec::Mocks::ConstantMutator::BaseMutator
1381
+ def mutate; end
1382
+ def reset; end
1383
+ def to_constant; end
1384
+
1385
+ private
1386
+
1387
+ def name_for(parent, name); end
1388
+ end
1389
+
1390
+ # @private
1391
+ RSpec::Mocks::DEFAULT_CALLBACK_INVOCATION_STRATEGY = T.let(T.unsafe(nil), RSpec::Mocks::CallbackInvocationStrategy)
1392
+
1393
+ # An implementation of rspec-mocks' reference interface.
1394
+ # Used when an object is passed to {ExampleMethods#object_double}, or
1395
+ # an anonymous class or module is passed to {ExampleMethods#instance_double}
1396
+ # or {ExampleMethods#class_double}.
1397
+ # Represents a reference to that object.
1398
+ #
1399
+ # @see NamedObjectReference
1400
+ class RSpec::Mocks::DirectObjectReference
1401
+ # @param object [Object] the object to which this refers
1402
+ # @return [DirectObjectReference] a new instance of DirectObjectReference
1403
+ def initialize(object); end
1404
+
1405
+ # Defined for interface parity with the other object reference
1406
+ # implementations. Raises an `ArgumentError` to indicate that `as_stubbed_const`
1407
+ # is invalid when passing an object argument to `object_double`.
1408
+ #
1409
+ # @raise [ArgumentError]
1410
+ def const_to_replace; end
1411
+
1412
+ # Always returns true for an object as the class is defined.
1413
+ #
1414
+ # @return [true]
1415
+ def defined?; end
1416
+
1417
+ # @return [String] the object's description (via `#inspect`).
1418
+ def description; end
1419
+
1420
+ # The target of the verifying double (the object itself).
1421
+ #
1422
+ # @return [Object]
1423
+ def target; end
1424
+
1425
+ # Yields if the reference target is loaded, providing a generic mechanism
1426
+ # to optionally run a bit of code only when a reference's target is
1427
+ # loaded.
1428
+ #
1429
+ # This specific implementation always yields because direct references
1430
+ # are always loaded.
1431
+ #
1432
+ # @yield [Object] the target of this reference.
1433
+ def when_loaded; end
1434
+ end
1435
+
1436
+ # A generic test double object. `double`, `instance_double` and friends
1437
+ # return an instance of this.
1438
+ class RSpec::Mocks::Double
1439
+ include ::RSpec::Mocks::TestDouble
1440
+ end
1441
+
1442
+ # @private
1443
+ class RSpec::Mocks::ErrorGenerator
1444
+ # @return [ErrorGenerator] a new instance of ErrorGenerator
1445
+ def initialize(target = T.unsafe(nil)); end
1446
+
1447
+ def default_error_message(expectation, expected_args, actual_args); end
1448
+
1449
+ # @private
1450
+ def describe_expectation(verb, message, expected_received_count, _actual_received_count, args); end
1451
+
1452
+ def expectation_on_nil_message(method_name); end
1453
+
1454
+ # @private
1455
+ def intro(unwrapped = T.unsafe(nil)); end
1456
+
1457
+ # @private
1458
+ def method_call_args_description(args, generic_prefix = T.unsafe(nil), matcher_prefix = T.unsafe(nil)); end
1459
+
1460
+ # @private
1461
+ def opts; end
1462
+
1463
+ # Sets the attribute opts
1464
+ #
1465
+ # @param value the value to set the attribute opts to.
1466
+ def opts=(_arg0); end
1467
+
1468
+ # @private
1469
+ def raise_already_invoked_error(message, calling_customization); end
1470
+
1471
+ # @private
1472
+ def raise_cant_constrain_count_for_negated_have_received_error(count_constraint); end
1473
+
1474
+ # @private
1475
+ def raise_double_negation_error(wrapped_expression); end
1476
+
1477
+ # @private
1478
+ def raise_expectation_error(message, expected_received_count, argument_list_matcher, actual_received_count, expectation_count_type, args, backtrace_line = T.unsafe(nil), source_id = T.unsafe(nil)); end
1479
+
1480
+ # @private
1481
+ def raise_expectation_on_mocked_method(method); end
1482
+
1483
+ def raise_expectation_on_nil_error(method_name); end
1484
+
1485
+ # @private
1486
+ def raise_expectation_on_unstubbed_method(method); end
1487
+
1488
+ # @private
1489
+ # @raise [ExpiredTestDoubleError]
1490
+ def raise_expired_test_double_error; end
1491
+
1492
+ # @private
1493
+ def raise_have_received_disallowed(type, reason); end
1494
+
1495
+ # @private
1496
+ def raise_invalid_arguments_error(verifier); end
1497
+
1498
+ # @private
1499
+ def raise_method_not_stubbed_error(method_name); end
1500
+
1501
+ # @private
1502
+ def raise_missing_block_error(args_to_yield); end
1503
+
1504
+ # @private
1505
+ def raise_missing_default_stub_error(expectation, args_for_multiple_calls); end
1506
+
1507
+ # @private
1508
+ # @raise [NoMethodError]
1509
+ def raise_non_public_error(method_name, visibility); end
1510
+
1511
+ # @private
1512
+ def raise_only_valid_on_a_partial_double(method); end
1513
+
1514
+ # @private
1515
+ def raise_out_of_order_error(message); end
1516
+
1517
+ # @private
1518
+ def raise_similar_message_args_error(expectation, args_for_multiple_calls, backtrace_line = T.unsafe(nil)); end
1519
+
1520
+ # @private
1521
+ def raise_unexpected_message_args_error(expectation, args_for_multiple_calls, source_id = T.unsafe(nil)); end
1522
+
1523
+ # @private
1524
+ def raise_unexpected_message_error(message, args); end
1525
+
1526
+ # @private
1527
+ def raise_unimplemented_error(doubled_module, method_name, object); end
1528
+
1529
+ # @private
1530
+ def raise_verifying_double_not_defined_error(ref); end
1531
+
1532
+ # @private
1533
+ def raise_wrong_arity_error(args_to_yield, signature); end
1534
+
1535
+ private
1536
+
1537
+ def __raise(message, backtrace_line = T.unsafe(nil), source_id = T.unsafe(nil)); end
1538
+ def arg_list(args); end
1539
+ def count_message(count, expectation_count_type = T.unsafe(nil)); end
1540
+ def diff_message(expected_args, actual_args); end
1541
+ def differ; end
1542
+ def error_message(expectation, args_for_multiple_calls); end
1543
+ def expected_part_of_expectation_error(expected_received_count, expectation_count_type, argument_list_matcher); end
1544
+ def format_args(args); end
1545
+ def format_received_args(args_for_multiple_calls); end
1546
+ def group_count(index, args); end
1547
+ def grouped_args(args); end
1548
+
1549
+ # @return [Boolean]
1550
+ def list_of_exactly_one_string?(args); end
1551
+
1552
+ def notify(*args); end
1553
+ def prepend_to_backtrace(exception, line); end
1554
+ def received_part_of_expectation_error(actual_received_count, args); end
1555
+ def times(count); end
1556
+ def unexpected_arguments_message(expected_args_string, actual_args_string); end
1557
+ def unpack_string_args(formatted_expected_args, actual_args); end
1558
+ end
1559
+
1560
+ # Contains methods intended to be used from within code examples.
1561
+ # Mix this in to your test context (such as a test framework base class)
1562
+ # to use rspec-mocks with your test framework. If you're using rspec-core,
1563
+ # it'll take care of doing this for you.
1564
+ module RSpec::Mocks::ExampleMethods
1565
+ include ::RSpec::Mocks::ArgumentMatchers
1566
+ include ::RSpec::Mocks::ExampleMethods::ExpectHost
1567
+
1568
+ # Used to wrap an object in preparation for stubbing a method
1569
+ # on it.
1570
+ #
1571
+ # @example
1572
+ # allow(dbl).to receive(:foo).with(5).and_return(:return_value)
1573
+ # @note If you disable the `:expect` syntax this method will be undefined.
1574
+ def allow(target); end
1575
+
1576
+ # Used to wrap a class in preparation for stubbing a method
1577
+ # on instances of it.
1578
+ #
1579
+ # @example
1580
+ # allow_any_instance_of(MyClass).to receive(:foo)
1581
+ # @note This is only available when you have enabled the `expect` syntax.
1582
+ def allow_any_instance_of(klass); end
1583
+
1584
+ # Disables warning messages about expectations being set on nil.
1585
+ #
1586
+ # By default warning messages are issued when expectations are set on
1587
+ # nil. This is to prevent false-positives and to catch potential bugs
1588
+ # early on.
1589
+ #
1590
+ # @deprecated Use {RSpec::Mocks::Configuration#allow_message_expectations_on_nil} instead.
1591
+ def allow_message_expectations_on_nil; end
1592
+
1593
+ # Constructs a test double against a specific class. If the given class
1594
+ # name has been loaded, only class methods defined on the class are
1595
+ # allowed to be stubbed. In all other ways it behaves like a
1596
+ # [double](double).
1597
+ #
1598
+ # @overload class_double
1599
+ # @overload class_double
1600
+ # @overload class_double
1601
+ # @overload class_double
1602
+ # @return ClassVerifyingDouble
1603
+ def class_double(doubled_class, *args); end
1604
+
1605
+ # Constructs a test double that is optimized for use with `have_received`
1606
+ # against a specific class. If the given class name has been loaded,
1607
+ # only class methods defined on the class are allowed to be stubbed.
1608
+ # With a normal double one has to stub methods in order to be able to spy
1609
+ # them. An class_spy automatically spies on all class methods to which the
1610
+ # class responds.
1611
+ #
1612
+ # @overload class_spy
1613
+ # @overload class_spy
1614
+ # @overload class_spy
1615
+ # @overload class_spy
1616
+ # @return ClassVerifyingDouble
1617
+ def class_spy(*args); end
1618
+
1619
+ # Constructs an instance of [RSpec::Mocks::Double](RSpec::Mocks::Double) configured
1620
+ # with an optional name, used for reporting in failure messages, and an optional
1621
+ # hash of message/return-value pairs.
1622
+ #
1623
+ # @example
1624
+ # book = double("book", :title => "The RSpec Book")
1625
+ # book.title #=> "The RSpec Book"
1626
+ #
1627
+ # card = double("card", :suit => "Spades", :rank => "A")
1628
+ # card.suit #=> "Spades"
1629
+ # card.rank #=> "A"
1630
+ # @overload double
1631
+ # @overload double
1632
+ # @overload double
1633
+ # @overload double
1634
+ # @return [Double]
1635
+ def double(*args); end
1636
+
1637
+ # Used to wrap a class in preparation for setting a mock expectation
1638
+ # on instances of it.
1639
+ #
1640
+ # @example
1641
+ # expect_any_instance_of(MyClass).to receive(:foo)
1642
+ # @note If you disable the `:expect` syntax this method will be undefined.
1643
+ def expect_any_instance_of(klass); end
1644
+
1645
+ # Verifies that the given object received the expected message during the
1646
+ # course of the test. On a spy objects or as null object doubles this
1647
+ # works for any method, on other objects the method must have
1648
+ # been stubbed beforehand in order for messages to be verified.
1649
+ #
1650
+ # Stubbing and verifying messages received in this way implements the
1651
+ # Test Spy pattern.
1652
+ #
1653
+ # @example
1654
+ # invitation = double('invitation', accept: true)
1655
+ # user.accept_invitation(invitation)
1656
+ # expect(invitation).to have_received(:accept)
1657
+ #
1658
+ # # You can also use most message expectations:
1659
+ # expect(invitation).to have_received(:accept).with(mailer).once
1660
+ # @note `have_received(...).with(...)` is unable to work properly when
1661
+ # passed arguments are mutated after the spy records the received message.
1662
+ # @param method_name [Symbol] name of the method expected to have been
1663
+ # called.
1664
+ def have_received(method_name, &block); end
1665
+
1666
+ # Hides the named constant with the given value. The constant will be
1667
+ # undefined for the duration of the test.
1668
+ #
1669
+ # Like method stubs, the constant will be restored to its original value
1670
+ # when the example completes.
1671
+ #
1672
+ # @example
1673
+ # hide_const("MyClass") # => MyClass is now an undefined constant
1674
+ # @param constant_name [String] The fully qualified name of the constant.
1675
+ # The current constant scoping at the point of call is not considered.
1676
+ def hide_const(constant_name); end
1677
+
1678
+ # Constructs a test double against a specific class. If the given class
1679
+ # name has been loaded, only instance methods defined on the class are
1680
+ # allowed to be stubbed. In all other ways it behaves like a
1681
+ # [double](double).
1682
+ #
1683
+ # @overload instance_double
1684
+ # @overload instance_double
1685
+ # @overload instance_double
1686
+ # @overload instance_double
1687
+ # @return InstanceVerifyingDouble
1688
+ def instance_double(doubled_class, *args); end
1689
+
1690
+ # Constructs a test double that is optimized for use with `have_received`
1691
+ # against a specific class. If the given class name has been loaded, only
1692
+ # instance methods defined on the class are allowed to be stubbed. With
1693
+ # a normal double one has to stub methods in order to be able to spy
1694
+ # them. An instance_spy automatically spies on all instance methods to
1695
+ # which the class responds.
1696
+ #
1697
+ # @overload instance_spy
1698
+ # @overload instance_spy
1699
+ # @overload instance_spy
1700
+ # @overload instance_spy
1701
+ # @return InstanceVerifyingDouble
1702
+ def instance_spy(*args); end
1703
+
1704
+ # Constructs a test double against a specific object. Only the methods
1705
+ # the object responds to are allowed to be stubbed. If a String argument
1706
+ # is provided, it is assumed to reference a constant object which is used
1707
+ # for verification. In all other ways it behaves like a [double](double).
1708
+ #
1709
+ # @overload object_double
1710
+ # @overload object_double
1711
+ # @overload object_double
1712
+ # @overload object_double
1713
+ # @return ObjectVerifyingDouble
1714
+ def object_double(object_or_name, *args); end
1715
+
1716
+ # Constructs a test double that is optimized for use with `have_received`
1717
+ # against a specific object. Only instance methods defined on the object
1718
+ # are allowed to be stubbed. With a normal double one has to stub
1719
+ # methods in order to be able to spy them. An object_spy automatically
1720
+ # spies on all methods to which the object responds.
1721
+ #
1722
+ # @overload object_spy
1723
+ # @overload object_spy
1724
+ # @overload object_spy
1725
+ # @overload object_spy
1726
+ # @return ObjectVerifyingDouble
1727
+ def object_spy(*args); end
1728
+
1729
+ # Used to specify a message that you expect or allow an object
1730
+ # to receive. The object returned by `receive` supports the same
1731
+ # fluent interface that `should_receive` and `stub` have always
1732
+ # supported, allowing you to constrain the arguments or number of
1733
+ # times, and configure how the object should respond to the message.
1734
+ #
1735
+ # @example
1736
+ # expect(obj).to receive(:hello).with("world").exactly(3).times
1737
+ # @note If you disable the `:expect` syntax this method will be undefined.
1738
+ def receive(method_name, &block); end
1739
+
1740
+ # stubs/mocks a chain of messages on an object or test double.
1741
+ #
1742
+ # ## Warning:
1743
+ #
1744
+ # Chains can be arbitrarily long, which makes it quite painless to
1745
+ # violate the Law of Demeter in violent ways, so you should consider any
1746
+ # use of `receive_message_chain` a code smell. Even though not all code smells
1747
+ # indicate real problems (think fluent interfaces), `receive_message_chain` still
1748
+ # results in brittle examples. For example, if you write
1749
+ # `allow(foo).to receive_message_chain(:bar, :baz => 37)` in a spec and then the
1750
+ # implementation calls `foo.baz.bar`, the stub will not work.
1751
+ #
1752
+ # @example
1753
+ # allow(double).to receive_message_chain("foo.bar") { :baz }
1754
+ # allow(double).to receive_message_chain(:foo, :bar => :baz)
1755
+ # allow(double).to receive_message_chain(:foo, :bar) { :baz }
1756
+ #
1757
+ # # Given any of ^^ these three forms ^^:
1758
+ # double.foo.bar # => :baz
1759
+ #
1760
+ # # Common use in Rails/ActiveRecord:
1761
+ # allow(Article).to receive_message_chain("recent.published") { [Article.new] }
1762
+ # @note If you disable the `:expect` syntax this method will be undefined.
1763
+ # @overload receive_message_chain
1764
+ # @overload receive_message_chain
1765
+ # @overload receive_message_chain
1766
+ def receive_message_chain(*messages, &block); end
1767
+
1768
+ # Shorthand syntax used to setup message(s), and their return value(s),
1769
+ # that you expect or allow an object to receive. The method takes a hash
1770
+ # of messages and their respective return values. Unlike with `receive`,
1771
+ # you cannot apply further customizations using a block or the fluent
1772
+ # interface.
1773
+ #
1774
+ # @example
1775
+ # allow(obj).to receive_messages(:speak => "Hello World")
1776
+ # allow(obj).to receive_messages(:speak => "Hello", :meow => "Meow")
1777
+ # @note If you disable the `:expect` syntax this method will be undefined.
1778
+ def receive_messages(message_return_value_hash); end
1779
+
1780
+ # Constructs a test double that is optimized for use with
1781
+ # `have_received`. With a normal double one has to stub methods in order
1782
+ # to be able to spy them. A spy automatically spies on all methods.
1783
+ #
1784
+ # @overload spy
1785
+ # @overload spy
1786
+ # @overload spy
1787
+ # @overload spy
1788
+ # @return [Double]
1789
+ def spy(*args); end
1790
+
1791
+ # Stubs the named constant with the given value.
1792
+ # Like method stubs, the constant will be restored
1793
+ # to its original value (or lack of one, if it was
1794
+ # undefined) when the example completes.
1795
+ #
1796
+ # @example
1797
+ # stub_const("MyClass", Class.new) # => Replaces (or defines) MyClass with a new class object.
1798
+ # stub_const("SomeModel::PER_PAGE", 5) # => Sets SomeModel::PER_PAGE to 5.
1799
+ #
1800
+ # class CardDeck
1801
+ # SUITS = [:Spades, :Diamonds, :Clubs, :Hearts]
1802
+ # NUM_CARDS = 52
1803
+ # end
1804
+ #
1805
+ # stub_const("CardDeck", Class.new)
1806
+ # CardDeck::SUITS # => uninitialized constant error
1807
+ # CardDeck::NUM_CARDS # => uninitialized constant error
1808
+ #
1809
+ # stub_const("CardDeck", Class.new, :transfer_nested_constants => true)
1810
+ # CardDeck::SUITS # => our suits array
1811
+ # CardDeck::NUM_CARDS # => 52
1812
+ #
1813
+ # stub_const("CardDeck", Class.new, :transfer_nested_constants => [:SUITS])
1814
+ # CardDeck::SUITS # => our suits array
1815
+ # CardDeck::NUM_CARDS # => uninitialized constant error
1816
+ # @option options
1817
+ # @param constant_name [String] The fully qualified name of the constant. The current
1818
+ # constant scoping at the point of call is not considered.
1819
+ # @param value [Object] The value to make the constant refer to. When the
1820
+ # example completes, the constant will be restored to its prior state.
1821
+ # @param options [Hash] Stubbing options.
1822
+ # @return [Object] the stubbed value of the constant
1823
+ def stub_const(constant_name, value, options = T.unsafe(nil)); end
1824
+
1825
+ # Turns off the verifying of partial doubles for the duration of the
1826
+ # block, this is useful in situations where methods are defined at run
1827
+ # time and you wish to define stubs for them but not turn off partial
1828
+ # doubles for the entire run suite. (e.g. view specs in rspec-rails).
1829
+ def without_partial_double_verification; end
1830
+
1831
+ class << self
1832
+ # @private
1833
+ def declare_double(type, *args); end
1834
+
1835
+ # @private
1836
+ def declare_verifying_double(type, ref, *args); end
1837
+
1838
+ # @private
1839
+ # @private
1840
+ def extended(object); end
1841
+
1842
+ # @private
1843
+ # @private
1844
+ def included(klass); end
1845
+ end
1846
+ end
1847
+
1848
+ # This module exists to host the `expect` method for cases where
1849
+ # rspec-mocks is used w/o rspec-expectations.
1850
+ module RSpec::Mocks::ExampleMethods::ExpectHost
1851
+ def expect(target); end
1852
+ end
1853
+
1854
+ # @private
1855
+ class RSpec::Mocks::ExpectChain < ::RSpec::Mocks::MessageChain
1856
+ private
1857
+
1858
+ def expectation(object, message, &return_block); end
1859
+
1860
+ class << self
1861
+ # @api private
1862
+ def expect_chain_on(object, *chain, &blk); end
1863
+ end
1864
+ end
1865
+
1866
+ # @private
1867
+ class RSpec::Mocks::ExpectationTarget < ::RSpec::Mocks::TargetBase
1868
+ include ::RSpec::Mocks::ExpectationTargetMethods
1869
+ end
1870
+
1871
+ # @private
1872
+ module RSpec::Mocks::ExpectationTargetMethods
1873
+ include ::RSpec::Mocks::TargetDelegationInstanceMethods
1874
+ extend ::RSpec::Mocks::TargetDelegationClassMethods
1875
+
1876
+ def expression; end
1877
+ def not_to(matcher, &block); end
1878
+ def to(matcher, &block); end
1879
+ def to_not(matcher, &block); end
1880
+ end
1881
+
1882
+ # Raised when a test double is used after it has been torn
1883
+ # down (typically at the end of an rspec-core example).
1884
+ class RSpec::Mocks::ExpiredTestDoubleError < ::RSpec::Mocks::MockExpectationError; end
1885
+
1886
+ # @private
1887
+ RSpec::Mocks::IGNORED_BACKTRACE_LINE = T.let(T.unsafe(nil), String)
1888
+
1889
+ # Represents a configured implementation. Takes into account
1890
+ # any number of sub-implementations.
1891
+ #
1892
+ # @private
1893
+ class RSpec::Mocks::Implementation
1894
+ def call(*args, &block); end
1895
+
1896
+ # Returns the value of attribute initial_action.
1897
+ def initial_action; end
1898
+
1899
+ # Sets the attribute initial_action
1900
+ #
1901
+ # @param value the value to set the attribute initial_action to.
1902
+ def initial_action=(_arg0); end
1903
+
1904
+ # Returns the value of attribute inner_action.
1905
+ def inner_action; end
1906
+
1907
+ # Sets the attribute inner_action
1908
+ #
1909
+ # @param value the value to set the attribute inner_action to.
1910
+ def inner_action=(_arg0); end
1911
+
1912
+ # @return [Boolean]
1913
+ def present?; end
1914
+
1915
+ # Returns the value of attribute terminal_action.
1916
+ def terminal_action; end
1917
+
1918
+ # Sets the attribute terminal_action
1919
+ #
1920
+ # @param value the value to set the attribute terminal_action to.
1921
+ def terminal_action=(_arg0); end
1922
+
1923
+ private
1924
+
1925
+ def actions; end
1926
+ end
1927
+
1928
+ # @private
1929
+ class RSpec::Mocks::InstanceMethodReference < ::RSpec::Mocks::MethodReference
1930
+ private
1931
+
1932
+ def find_method(mod); end
1933
+
1934
+ # Ideally, we'd use `respond_to?` for `method_implemented?` but we need a
1935
+ # reference to an instance to do that and we don't have one. Note that
1936
+ # we may get false negatives: if the method is implemented via
1937
+ # `method_missing`, we'll return `false` even though it meets our
1938
+ # definition of "implemented". However, it's the best we can do.
1939
+ #
1940
+ # @return [Boolean]
1941
+ def method_defined?(mod); end
1942
+
1943
+ # @return [Boolean]
1944
+ def method_implemented?(mod); end
1945
+
1946
+ def visibility_from(mod); end
1947
+ end
1948
+
1949
+ # @private
1950
+ class RSpec::Mocks::InstanceMethodStasher
1951
+ # @return [InstanceMethodStasher] a new instance of InstanceMethodStasher
1952
+ def initialize(object, method); end
1953
+
1954
+ # ruby 2.0.0-p247 and 2.0.0-p195 both have a bug that we can't work around :(.
1955
+ # https://bugs.ruby-lang.org/issues/8686
1956
+ def handle_restoration_failures; end
1957
+
1958
+ # @private
1959
+ # @return [Boolean]
1960
+ def method_is_stashed?; end
1961
+
1962
+ # Returns the value of attribute original_method.
1963
+ def original_method; end
1964
+
1965
+ # @private
1966
+ def restore; end
1967
+
1968
+ # @private
1969
+ def stash; end
1970
+
1971
+ private
1972
+
1973
+ # @private
1974
+ # @return [Boolean]
1975
+ def method_defined_directly_on_klass?; end
1976
+
1977
+ # @private
1978
+ # @return [Boolean]
1979
+ def method_defined_on_klass?(klass = T.unsafe(nil)); end
1980
+
1981
+ # @return [Boolean]
1982
+ def method_owned_by_klass?; end
1983
+ end
1984
+
1985
+ # A mock providing a custom proxy that can verify the validity of any
1986
+ # method stubs or expectations against the public instance methods of the
1987
+ # given class.
1988
+ #
1989
+ # @private
1990
+ class RSpec::Mocks::InstanceVerifyingDouble
1991
+ include ::RSpec::Mocks::TestDouble
1992
+ include ::RSpec::Mocks::VerifyingDouble
1993
+
1994
+ def __build_mock_proxy(order_group); end
1995
+ end
1996
+
1997
+ # Support for `patch_marshal_to_support_partial_doubles` configuration.
1998
+ #
1999
+ # @private
2000
+ class RSpec::Mocks::MarshalExtension
2001
+ class << self
2002
+ def patch!; end
2003
+ def unpatch!; end
2004
+ end
2005
+ end
2006
+
2007
+ # Namespace for mock-related matchers.
2008
+ module RSpec::Mocks::Matchers; end
2009
+
2010
+ # @private
2011
+ class RSpec::Mocks::Matchers::ExpectationCustomization
2012
+ # @return [ExpectationCustomization] a new instance of ExpectationCustomization
2013
+ def initialize(method_name, args, block); end
2014
+
2015
+ # Returns the value of attribute block.
2016
+ def block; end
2017
+
2018
+ # Sets the attribute block
2019
+ #
2020
+ # @param value the value to set the attribute block to.
2021
+ def block=(_arg0); end
2022
+
2023
+ def playback_onto(expectation); end
2024
+ end
2025
+
2026
+ # @private
2027
+ class RSpec::Mocks::Matchers::HaveReceived
2028
+ include ::RSpec::Mocks::Matchers::Matcher
2029
+
2030
+ # @return [HaveReceived] a new instance of HaveReceived
2031
+ def initialize(method_name, &block); end
2032
+
2033
+ def at_least(*args); end
2034
+ def at_most(*args); end
2035
+ def description; end
2036
+
2037
+ # @return [Boolean]
2038
+ def does_not_match?(subject); end
2039
+
2040
+ def exactly(*args); end
2041
+ def failure_message; end
2042
+ def failure_message_when_negated; end
2043
+
2044
+ # @return [Boolean]
2045
+ def matches?(subject, &block); end
2046
+
2047
+ def name; end
2048
+ def once(*args); end
2049
+ def ordered(*args); end
2050
+ def setup_allowance(_subject, &_block); end
2051
+ def setup_any_instance_allowance(_subject, &_block); end
2052
+ def setup_any_instance_expectation(_subject, &_block); end
2053
+ def setup_any_instance_negative_expectation(_subject, &_block); end
2054
+ def setup_expectation(subject, &block); end
2055
+ def setup_negative_expectation(subject, &block); end
2056
+ def thrice(*args); end
2057
+ def time(*args); end
2058
+ def times(*args); end
2059
+ def twice(*args); end
2060
+ def with(*args); end
2061
+
2062
+ private
2063
+
2064
+ def apply_constraints_to(expectation); end
2065
+ def capture_failure_message; end
2066
+ def count_constraint; end
2067
+ def disallow(type, reason = T.unsafe(nil)); end
2068
+ def ensure_count_unconstrained; end
2069
+ def expect; end
2070
+
2071
+ # @return [Boolean]
2072
+ def expected_messages_received_in_order?; end
2073
+
2074
+ def mock_proxy; end
2075
+ def notify_failure_message; end
2076
+ end
2077
+
2078
+ RSpec::Mocks::Matchers::HaveReceived::ARGS_CONSTRAINTS = T.let(T.unsafe(nil), Array)
2079
+ RSpec::Mocks::Matchers::HaveReceived::CONSTRAINTS = T.let(T.unsafe(nil), Array)
2080
+ RSpec::Mocks::Matchers::HaveReceived::COUNT_CONSTRAINTS = T.let(T.unsafe(nil), Array)
2081
+
2082
+ # just a "tag" for rspec-mock matchers detection
2083
+ #
2084
+ # @private
2085
+ module RSpec::Mocks::Matchers::Matcher; end
2086
+
2087
+ # @private
2088
+ class RSpec::Mocks::Matchers::Receive
2089
+ include ::RSpec::Mocks::Matchers::Matcher
2090
+
2091
+ # @return [Receive] a new instance of Receive
2092
+ def initialize(message, block); end
2093
+
2094
+ def and_call_original(*args, &block); end
2095
+ def and_invoke(*args, &block); end
2096
+ def and_raise(*args, &block); end
2097
+ def and_return(*args, &block); end
2098
+ def and_throw(*args, &block); end
2099
+ def and_wrap_original(*args, &block); end
2100
+ def and_yield(*args, &block); end
2101
+ def at_least(*args, &block); end
2102
+ def at_most(*args, &block); end
2103
+ def description; end
2104
+ def does_not_match?(subject, &block); end
2105
+ def exactly(*args, &block); end
2106
+ def matches?(subject, &block); end
2107
+ def name; end
2108
+ def never(*args, &block); end
2109
+ def once(*args, &block); end
2110
+ def ordered(*args, &block); end
2111
+ def setup_allowance(subject, &block); end
2112
+ def setup_any_instance_allowance(subject, &block); end
2113
+ def setup_any_instance_expectation(subject, &block); end
2114
+ def setup_any_instance_negative_expectation(subject, &block); end
2115
+ def setup_expectation(subject, &block); end
2116
+ def setup_negative_expectation(subject, &block); end
2117
+ def thrice(*args, &block); end
2118
+ def time(*args, &block); end
2119
+ def times(*args, &block); end
2120
+ def twice(*args, &block); end
2121
+ def with(*args, &block); end
2122
+
2123
+ private
2124
+
2125
+ def describable; end
2126
+ def move_block_to_last_customization(block); end
2127
+ def setup_any_instance_method_substitute(subject, method, block); end
2128
+ def setup_method_substitute(host, method, block, *args); end
2129
+ def setup_mock_proxy_method_substitute(subject, method, block); end
2130
+ def warn_if_any_instance(expression, subject); end
2131
+ end
2132
+
2133
+ # MessageExpectation objects are able to describe themselves in detail.
2134
+ # We use this as a fall back when a MessageExpectation is not available.
2135
+ #
2136
+ # @private
2137
+ class RSpec::Mocks::Matchers::Receive::DefaultDescribable
2138
+ # @return [DefaultDescribable] a new instance of DefaultDescribable
2139
+ def initialize(message); end
2140
+
2141
+ # This is much simpler for the `any_instance` case than what the
2142
+ # user may want, but I'm not up for putting a bunch of effort
2143
+ # into full descriptions for `any_instance` expectations at this point :(.
2144
+ def description_for(verb); end
2145
+ end
2146
+
2147
+ # @private
2148
+ class RSpec::Mocks::Matchers::ReceiveMessageChain
2149
+ include ::RSpec::Mocks::Matchers::Matcher
2150
+
2151
+ # @return [ReceiveMessageChain] a new instance of ReceiveMessageChain
2152
+ def initialize(chain, &block); end
2153
+
2154
+ def and_call_original(*args, &block); end
2155
+ def and_invoke(*args, &block); end
2156
+ def and_raise(*args, &block); end
2157
+ def and_return(*args, &block); end
2158
+ def and_throw(*args, &block); end
2159
+ def and_yield(*args, &block); end
2160
+ def description; end
2161
+
2162
+ # @raise [NegationUnsupportedError]
2163
+ def does_not_match?(*_args); end
2164
+
2165
+ def matches?(subject, &block); end
2166
+ def name; end
2167
+ def setup_allowance(subject, &block); end
2168
+ def setup_any_instance_allowance(subject, &block); end
2169
+ def setup_any_instance_expectation(subject, &block); end
2170
+ def setup_expectation(subject, &block); end
2171
+
2172
+ # @raise [NegationUnsupportedError]
2173
+ def setup_negative_expectation(*_args); end
2174
+
2175
+ def with(*args, &block); end
2176
+
2177
+ private
2178
+
2179
+ def formatted_chain; end
2180
+ def replay_customizations(chain); end
2181
+ end
2182
+
2183
+ # @private
2184
+ class RSpec::Mocks::Matchers::ReceiveMessages
2185
+ include ::RSpec::Mocks::Matchers::Matcher
2186
+
2187
+ # @return [ReceiveMessages] a new instance of ReceiveMessages
2188
+ def initialize(message_return_value_hash); end
2189
+
2190
+ def description; end
2191
+
2192
+ # @raise [NegationUnsupportedError]
2193
+ def does_not_match?(_subject); end
2194
+
2195
+ def matches?(subject); end
2196
+ def name; end
2197
+ def setup_allowance(subject); end
2198
+ def setup_any_instance_allowance(subject); end
2199
+ def setup_any_instance_expectation(subject); end
2200
+ def setup_expectation(subject); end
2201
+
2202
+ # @raise [NegationUnsupportedError]
2203
+ def setup_negative_expectation(_subject); end
2204
+
2205
+ def warn_about_block; end
2206
+
2207
+ private
2208
+
2209
+ def any_instance_of(subject); end
2210
+ def each_message_on(host); end
2211
+ def proxy_on(subject); end
2212
+ end
2213
+
2214
+ # @private
2215
+ class RSpec::Mocks::MessageChain
2216
+ # @return [MessageChain] a new instance of MessageChain
2217
+ def initialize(object, *chain, &blk); end
2218
+
2219
+ # Returns the value of attribute block.
2220
+ def block; end
2221
+
2222
+ # Returns the value of attribute chain.
2223
+ def chain; end
2224
+
2225
+ # Returns the value of attribute object.
2226
+ def object; end
2227
+
2228
+ # @api private
2229
+ def setup_chain; end
2230
+
2231
+ private
2232
+
2233
+ def chain_on(object, *chain, &block); end
2234
+ def find_matching_expectation; end
2235
+ def find_matching_stub; end
2236
+ def format_chain(*chain, &blk); end
2237
+ end
2238
+
2239
+ # Represents an individual method stub or message expectation. The methods
2240
+ # defined here can be used to configure how it behaves. The methods return
2241
+ # `self` so that they can be chained together to form a fluent interface.
2242
+ class RSpec::Mocks::MessageExpectation
2243
+ include ::RSpec::Mocks::MessageExpectation::ImplementationDetails
2244
+
2245
+ # Tells the object to delegate to the original unmodified method
2246
+ # when it receives the message.
2247
+ #
2248
+ # @example
2249
+ # expect(counter).to receive(:increment).and_call_original
2250
+ # original_count = counter.count
2251
+ # counter.increment
2252
+ # expect(counter.count).to eq(original_count + 1)
2253
+ # @note This is only available on partial doubles.
2254
+ # @return [nil] No further chaining is supported after this.
2255
+ def and_call_original; end
2256
+
2257
+ # Tells the object to invoke a Proc when it receives the message. Given
2258
+ # more than one value, the result of the first Proc is returned the first
2259
+ # time the message is received, the result of the second Proc is returned
2260
+ # the next time, etc, etc.
2261
+ #
2262
+ # If the message is received more times than there are Procs, the result of
2263
+ # the last Proc is returned for every subsequent call.
2264
+ #
2265
+ # @example
2266
+ # allow(api).to receive(:get_foo).and_invoke(-> { raise ApiTimeout })
2267
+ # api.get_foo # => raises ApiTimeout
2268
+ # api.get_foo # => raises ApiTimeout
2269
+ #
2270
+ # allow(api).to receive(:get_foo).and_invoke(-> { raise ApiTimeout }, -> { raise ApiTimeout }, -> { :a_foo })
2271
+ # api.get_foo # => raises ApiTimeout
2272
+ # api.get_foo # => rasies ApiTimeout
2273
+ # api.get_foo # => :a_foo
2274
+ # api.get_foo # => :a_foo
2275
+ # api.get_foo # => :a_foo
2276
+ # # etc
2277
+ # @return [nil] No further chaining is supported after this.
2278
+ def and_invoke(first_proc, *procs); end
2279
+
2280
+ # Tells the object to raise an exception when the message is received.
2281
+ #
2282
+ # @example
2283
+ # allow(car).to receive(:go).and_raise
2284
+ # allow(car).to receive(:go).and_raise(OutOfGas)
2285
+ # allow(car).to receive(:go).and_raise(OutOfGas, "At least 2 oz of gas needed to drive")
2286
+ # allow(car).to receive(:go).and_raise(OutOfGas.new(2, :oz))
2287
+ # @note When you pass an exception class, the MessageExpectation will raise
2288
+ # an instance of it, creating it with `exception` and passing `message`
2289
+ # if specified. If the exception class initializer requires more than
2290
+ # one parameters, you must pass in an instance and not the class,
2291
+ # otherwise this method will raise an ArgumentError exception.
2292
+ # @overload and_raise
2293
+ # @overload and_raise
2294
+ # @overload and_raise
2295
+ # @overload and_raise
2296
+ # @return [nil] No further chaining is supported after this.
2297
+ def and_raise(*args); end
2298
+
2299
+ # Tells the object to return a value when it receives the message. Given
2300
+ # more than one value, the first value is returned the first time the
2301
+ # message is received, the second value is returned the next time, etc,
2302
+ # etc.
2303
+ #
2304
+ # If the message is received more times than there are values, the last
2305
+ # value is returned for every subsequent call.
2306
+ #
2307
+ # @example
2308
+ # allow(counter).to receive(:count).and_return(1)
2309
+ # counter.count # => 1
2310
+ # counter.count # => 1
2311
+ #
2312
+ # allow(counter).to receive(:count).and_return(1,2,3)
2313
+ # counter.count # => 1
2314
+ # counter.count # => 2
2315
+ # counter.count # => 3
2316
+ # counter.count # => 3
2317
+ # counter.count # => 3
2318
+ # # etc
2319
+ # @overload and_return
2320
+ # @overload and_return
2321
+ # @return [nil] No further chaining is supported after this.
2322
+ def and_return(first_value, *values); end
2323
+
2324
+ # Tells the object to throw a symbol (with the object if that form is
2325
+ # used) when the message is received.
2326
+ #
2327
+ # @example
2328
+ # allow(car).to receive(:go).and_throw(:out_of_gas)
2329
+ # allow(car).to receive(:go).and_throw(:out_of_gas, :level => 0.1)
2330
+ # @overload and_throw
2331
+ # @overload and_throw
2332
+ # @return [nil] No further chaining is supported after this.
2333
+ def and_throw(*args); end
2334
+
2335
+ # Decorates the stubbed method with the supplied block. The original
2336
+ # unmodified method is passed to the block along with any method call
2337
+ # arguments so you can delegate to it, whilst still being able to
2338
+ # change what args are passed to it and/or change the return value.
2339
+ #
2340
+ # @example
2341
+ # expect(api).to receive(:large_list).and_wrap_original do |original_method, *args, &block|
2342
+ # original_method.call(*args, &block).first(10)
2343
+ # end
2344
+ # @note This is only available on partial doubles.
2345
+ # @return [nil] No further chaining is supported after this.
2346
+ def and_wrap_original(&block); end
2347
+
2348
+ # Tells the object to yield one or more args to a block when the message
2349
+ # is received.
2350
+ #
2351
+ # @example
2352
+ # stream.stub(:open).and_yield(StringIO.new)
2353
+ # @return [MessageExpectation] self, to support further chaining.
2354
+ # @yield [@eval_context = Object.new]
2355
+ def and_yield(*args, &block); end
2356
+
2357
+ # Constrain a message expectation to be received at least a specific
2358
+ # number of times.
2359
+ #
2360
+ # @example
2361
+ # expect(dealer).to receive(:deal_card).at_least(9).times
2362
+ # @return [MessageExpectation] self, to support further chaining.
2363
+ def at_least(n, &block); end
2364
+
2365
+ # Constrain a message expectation to be received at most a specific
2366
+ # number of times.
2367
+ #
2368
+ # @example
2369
+ # expect(dealer).to receive(:deal_card).at_most(10).times
2370
+ # @return [MessageExpectation] self, to support further chaining.
2371
+ def at_most(n, &block); end
2372
+
2373
+ # Constrain a message expectation to be received a specific number of
2374
+ # times.
2375
+ #
2376
+ # @example
2377
+ # expect(dealer).to receive(:deal_card).exactly(10).times
2378
+ # @return [MessageExpectation] self, to support further chaining.
2379
+ def exactly(n, &block); end
2380
+
2381
+ # @return [String] a nice representation of the message expectation
2382
+ def inspect; end
2383
+
2384
+ # Expect a message not to be received at all.
2385
+ #
2386
+ # @example
2387
+ # expect(car).to receive(:stop).never
2388
+ # @return [MessageExpectation] self, to support further chaining.
2389
+ def never; end
2390
+
2391
+ # Expect a message to be received exactly one time.
2392
+ #
2393
+ # @example
2394
+ # expect(car).to receive(:go).once
2395
+ # @return [MessageExpectation] self, to support further chaining.
2396
+ def once(&block); end
2397
+
2398
+ # Expect messages to be received in a specific order.
2399
+ #
2400
+ # @example
2401
+ # expect(api).to receive(:prepare).ordered
2402
+ # expect(api).to receive(:run).ordered
2403
+ # expect(api).to receive(:finish).ordered
2404
+ # @return [MessageExpectation] self, to support further chaining.
2405
+ def ordered(&block); end
2406
+
2407
+ # Expect a message to be received exactly three times.
2408
+ #
2409
+ # @example
2410
+ # expect(car).to receive(:go).thrice
2411
+ # @return [MessageExpectation] self, to support further chaining.
2412
+ def thrice(&block); end
2413
+
2414
+ # Syntactic sugar for `exactly`, `at_least` and `at_most`
2415
+ #
2416
+ # @example
2417
+ # expect(dealer).to receive(:deal_card).exactly(10).times
2418
+ # expect(dealer).to receive(:deal_card).at_least(10).times
2419
+ # expect(dealer).to receive(:deal_card).at_most(10).times
2420
+ # @return [MessageExpectation] self, to support further chaining.
2421
+ def time(&block); end
2422
+
2423
+ # Syntactic sugar for `exactly`, `at_least` and `at_most`
2424
+ #
2425
+ # @example
2426
+ # expect(dealer).to receive(:deal_card).exactly(10).times
2427
+ # expect(dealer).to receive(:deal_card).at_least(10).times
2428
+ # expect(dealer).to receive(:deal_card).at_most(10).times
2429
+ # @return [MessageExpectation] self, to support further chaining.
2430
+ def times(&block); end
2431
+
2432
+ # @return [String] a nice representation of the message expectation
2433
+ def to_s; end
2434
+
2435
+ # Expect a message to be received exactly two times.
2436
+ #
2437
+ # @example
2438
+ # expect(car).to receive(:go).twice
2439
+ # @return [MessageExpectation] self, to support further chaining.
2440
+ def twice(&block); end
2441
+
2442
+ # Constrains a stub or message expectation to invocations with specific
2443
+ # arguments.
2444
+ #
2445
+ # With a stub, if the message might be received with other args as well,
2446
+ # you should stub a default value first, and then stub or mock the same
2447
+ # message using `with` to constrain to specific arguments.
2448
+ #
2449
+ # A message expectation will fail if the message is received with different
2450
+ # arguments.
2451
+ #
2452
+ # @example
2453
+ # allow(cart).to receive(:add) { :failure }
2454
+ # allow(cart).to receive(:add).with(Book.new(:isbn => 1934356379)) { :success }
2455
+ # cart.add(Book.new(:isbn => 1234567890))
2456
+ # # => :failure
2457
+ # cart.add(Book.new(:isbn => 1934356379))
2458
+ # # => :success
2459
+ #
2460
+ # expect(cart).to receive(:add).with(Book.new(:isbn => 1934356379)) { :success }
2461
+ # cart.add(Book.new(:isbn => 1234567890))
2462
+ # # => failed expectation
2463
+ # cart.add(Book.new(:isbn => 1934356379))
2464
+ # # => passes
2465
+ # @return [MessageExpectation] self, to support further chaining.
2466
+ def with(*args, &block); end
2467
+ end
2468
+
2469
+ # Contains the parts of `MessageExpectation` that aren't part of
2470
+ # rspec-mocks' public API. The class is very big and could really use
2471
+ # some collaborators it delegates to for this stuff but for now this was
2472
+ # the simplest way to split the public from private stuff to make it
2473
+ # easier to publish the docs for the APIs we want published.
2474
+ #
2475
+ # @private
2476
+ module RSpec::Mocks::MessageExpectation::ImplementationDetails
2477
+ def initialize(error_generator, expectation_ordering, expected_from, method_double, type = T.unsafe(nil), opts = T.unsafe(nil), &implementation_block); end
2478
+
2479
+ # @return [Boolean]
2480
+ def actual_received_count_matters?; end
2481
+
2482
+ def additional_expected_calls; end
2483
+ def advise(*args); end
2484
+ def and_yield_receiver_to_implementation; end
2485
+
2486
+ # Sets the attribute argument_list_matcher
2487
+ #
2488
+ # @param value the value to set the attribute argument_list_matcher to.
2489
+ def argument_list_matcher=(_arg0); end
2490
+
2491
+ # @return [Boolean]
2492
+ def called_max_times?; end
2493
+
2494
+ def description_for(verb); end
2495
+ def ensure_expected_ordering_received!; end
2496
+
2497
+ # Returns the value of attribute error_generator.
2498
+ def error_generator; end
2499
+
2500
+ def expectation_count_type; end
2501
+ def expected_args; end
2502
+
2503
+ # @return [Boolean]
2504
+ def expected_messages_received?; end
2505
+
2506
+ def generate_error; end
2507
+
2508
+ # @return [Boolean]
2509
+ def ignoring_args?; end
2510
+
2511
+ # Returns the value of attribute implementation.
2512
+ def implementation; end
2513
+
2514
+ def increase_actual_received_count!; end
2515
+ def invoke(parent_stub, *args, &block); end
2516
+ def invoke_without_incrementing_received_count(parent_stub, *args, &block); end
2517
+
2518
+ # @return [Boolean]
2519
+ def matches?(message, *args); end
2520
+
2521
+ # @return [Boolean]
2522
+ def matches_at_least_count?; end
2523
+
2524
+ # @return [Boolean]
2525
+ def matches_at_most_count?; end
2526
+
2527
+ # @return [Boolean]
2528
+ def matches_exact_count?; end
2529
+
2530
+ def matches_name_but_not_args(message, *args); end
2531
+
2532
+ # Returns the value of attribute message.
2533
+ def message; end
2534
+
2535
+ # @return [Boolean]
2536
+ def negative?; end
2537
+
2538
+ # @return [Boolean]
2539
+ def negative_expectation_for?(message); end
2540
+
2541
+ # @return [Boolean]
2542
+ def ordered?; end
2543
+
2544
+ # Returns the value of attribute orig_object.
2545
+ def orig_object; end
2546
+
2547
+ def raise_out_of_order_error; end
2548
+ def raise_unexpected_message_args_error(args_for_multiple_calls); end
2549
+ def safe_invoke(parent_stub, *args, &block); end
2550
+ def similar_messages; end
2551
+
2552
+ # @private
2553
+ def type; end
2554
+
2555
+ def unadvise(args); end
2556
+ def verify_messages_received; end
2557
+
2558
+ # @return [Boolean]
2559
+ def yield_receiver_to_implementation_block?; end
2560
+
2561
+ protected
2562
+
2563
+ # Sets the attribute error_generator
2564
+ #
2565
+ # @param value the value to set the attribute error_generator to.
2566
+ def error_generator=(_arg0); end
2567
+
2568
+ # Sets the attribute expected_from
2569
+ #
2570
+ # @param value the value to set the attribute expected_from to.
2571
+ def expected_from=(_arg0); end
2572
+
2573
+ # Sets the attribute expected_received_count
2574
+ #
2575
+ # @param value the value to set the attribute expected_received_count to.
2576
+ def expected_received_count=(_arg0); end
2577
+
2578
+ # Sets the attribute implementation
2579
+ #
2580
+ # @param value the value to set the attribute implementation to.
2581
+ def implementation=(_arg0); end
2582
+
2583
+ private
2584
+
2585
+ def exception_source_id; end
2586
+
2587
+ # @return [Boolean]
2588
+ def has_been_invoked?; end
2589
+
2590
+ def initial_implementation_action=(action); end
2591
+ def inner_implementation_action=(action); end
2592
+ def invoke_incrementing_actual_calls_by(increment, allowed_to_fail, parent_stub, *args, &block); end
2593
+ def raise_already_invoked_error_if_necessary(calling_customization); end
2594
+ def set_expected_received_count(relativity, n); end
2595
+ def terminal_implementation_action=(action); end
2596
+ def warn_about_stub_override; end
2597
+ def wrap_original(method_name, &block); end
2598
+ end
2599
+
2600
+ # @private
2601
+ class RSpec::Mocks::MethodDouble
2602
+ # @private
2603
+ # @return [MethodDouble] a new instance of MethodDouble
2604
+ def initialize(object, method_name, proxy); end
2605
+
2606
+ # @private
2607
+ def add_default_stub(*args, &implementation); end
2608
+
2609
+ # @private
2610
+ def add_expectation(error_generator, expectation_ordering, expected_from, opts, &implementation); end
2611
+
2612
+ # @private
2613
+ def add_simple_expectation(method_name, response, error_generator, backtrace_line); end
2614
+
2615
+ # A simple stub can only return a concrete value for a message, and
2616
+ # cannot match on arguments. It is used as an optimization over
2617
+ # `add_stub` / `add_expectation` where it is known in advance that this
2618
+ # is all that will be required of a stub, such as when passing attributes
2619
+ # to the `double` example method. They do not stash or restore existing method
2620
+ # definitions.
2621
+ #
2622
+ # @private
2623
+ def add_simple_stub(method_name, response); end
2624
+
2625
+ # @private
2626
+ def add_stub(error_generator, expectation_ordering, expected_from, opts = T.unsafe(nil), &implementation); end
2627
+
2628
+ # @private
2629
+ def build_expectation(error_generator, expectation_ordering); end
2630
+
2631
+ # @private
2632
+ def clear; end
2633
+
2634
+ # @private
2635
+ def configure_method; end
2636
+
2637
+ # @private
2638
+ def define_proxy_method; end
2639
+
2640
+ # @private
2641
+ def expectations; end
2642
+
2643
+ # The type of message expectation to create has been extracted to its own
2644
+ # method so that subclasses can override it.
2645
+ #
2646
+ # @private
2647
+ def message_expectation_class; end
2648
+
2649
+ # @private
2650
+ def method_name; end
2651
+
2652
+ # @private
2653
+ def method_stasher; end
2654
+
2655
+ # @private
2656
+ def object; end
2657
+
2658
+ # @private
2659
+ def object_singleton_class; end
2660
+
2661
+ def original_implementation_callable; end
2662
+ def original_method; end
2663
+
2664
+ # The implementation of the proxied method. Subclasses may override this
2665
+ # method to perform additional operations.
2666
+ #
2667
+ # @private
2668
+ def proxy_method_invoked(_obj, *args, &block); end
2669
+
2670
+ # @private
2671
+ def raise_method_not_stubbed_error; end
2672
+
2673
+ # @private
2674
+ def remove_stub; end
2675
+
2676
+ # @private
2677
+ def remove_stub_if_present; end
2678
+
2679
+ # @private
2680
+ def reset; end
2681
+
2682
+ # @private
2683
+ def restore_original_method; end
2684
+
2685
+ # @private
2686
+ def restore_original_visibility; end
2687
+
2688
+ def save_original_implementation_callable!; end
2689
+
2690
+ # @private
2691
+ def setup_simple_method_double(method_name, response, collection, error_generator = T.unsafe(nil), backtrace_line = T.unsafe(nil)); end
2692
+
2693
+ # @private
2694
+ def show_frozen_warning; end
2695
+
2696
+ # @private
2697
+ def stubs; end
2698
+
2699
+ # @private
2700
+ def verify; end
2701
+
2702
+ # @private
2703
+ def visibility; end
2704
+
2705
+ private
2706
+
2707
+ def definition_target; end
2708
+ def new_rspec_prepended_module; end
2709
+ def remove_method_from_definition_target; end
2710
+ def usable_rspec_prepended_module; end
2711
+ end
2712
+
2713
+ # We subclass `Module` in order to be able to easily detect our prepended module.
2714
+ class RSpec::Mocks::MethodDouble::RSpecPrependedModule < ::Module; end
2715
+
2716
+ # Represents a method on an object that may or may not be defined.
2717
+ # The method may be an instance method on a module or a method on
2718
+ # any object.
2719
+ #
2720
+ # @private
2721
+ class RSpec::Mocks::MethodReference
2722
+ # @return [MethodReference] a new instance of MethodReference
2723
+ def initialize(object_reference, method_name); end
2724
+
2725
+ # A method is defined if we are able to get a `Method` object for it.
2726
+ # In that case, we can assert against metadata like the arity.
2727
+ #
2728
+ # @return [Boolean]
2729
+ def defined?; end
2730
+
2731
+ # A method is implemented if sending the message does not result in
2732
+ # a `NoMethodError`. It might be dynamically implemented by
2733
+ # `method_missing`.
2734
+ #
2735
+ # @return [Boolean]
2736
+ def implemented?; end
2737
+
2738
+ # Returns true if we definitively know that sending the method
2739
+ # will result in a `NoMethodError`.
2740
+ #
2741
+ # This is not simply the inverse of `implemented?`: there are
2742
+ # cases when we don't know if a method is implemented and
2743
+ # both `implemented?` and `unimplemented?` will return false.
2744
+ #
2745
+ # @return [Boolean]
2746
+ def unimplemented?; end
2747
+
2748
+ def visibility; end
2749
+
2750
+ # @yield [Support::MethodSignature.new(original)]
2751
+ def with_signature; end
2752
+
2753
+ private
2754
+
2755
+ def original_method; end
2756
+
2757
+ class << self
2758
+ def for(object_reference, method_name); end
2759
+ def instance_method_visibility_for(klass, method_name); end
2760
+ def method_defined_at_any_visibility?(klass, method_name); end
2761
+ def method_visibility_for(object, method_name); end
2762
+ end
2763
+ end
2764
+
2765
+ # Raised when an expectation customization method (e.g. `with`,
2766
+ # `and_return`) is called on a message expectation which has already been
2767
+ # invoked.
2768
+ class RSpec::Mocks::MockExpectationAlreadyInvokedError < ::Exception; end
2769
+
2770
+ # Raised when a message expectation is not satisfied.
2771
+ class RSpec::Mocks::MockExpectationError < ::Exception; end
2772
+
2773
+ # An implementation of rspec-mocks' reference interface.
2774
+ # Used when a string is passed to {ExampleMethods#object_double},
2775
+ # and when a string, named class or named module is passed to
2776
+ # {ExampleMethods#instance_double}, or {ExampleMethods#class_double}.
2777
+ # Represents a reference to the object named (via a constant lookup)
2778
+ # by the string.
2779
+ #
2780
+ # @see DirectObjectReference
2781
+ class RSpec::Mocks::NamedObjectReference
2782
+ # @param const_name [String] constant name
2783
+ # @return [NamedObjectReference] a new instance of NamedObjectReference
2784
+ def initialize(const_name); end
2785
+
2786
+ # @return [String] the constant name to replace with a double.
2787
+ def const_to_replace; end
2788
+
2789
+ # @return [Boolean] true if the named constant is defined, false otherwise.
2790
+ def defined?; end
2791
+
2792
+ # @return [String] the constant name to replace with a double.
2793
+ def description; end
2794
+
2795
+ # @return [Object, nil] the target of the verifying double (the named object), or
2796
+ # nil if it is not defined.
2797
+ def target; end
2798
+
2799
+ # Yields if the reference target is loaded, providing a generic mechanism
2800
+ # to optionally run a bit of code only when a reference's target is
2801
+ # loaded.
2802
+ #
2803
+ # @yield [Object] the target object
2804
+ def when_loaded; end
2805
+
2806
+ private
2807
+
2808
+ def object; end
2809
+ end
2810
+
2811
+ # @private
2812
+ class RSpec::Mocks::NegationUnsupportedError < ::StandardError; end
2813
+
2814
+ # @private
2815
+ class RSpec::Mocks::NestedSpace < ::RSpec::Mocks::Space
2816
+ # @return [NestedSpace] a new instance of NestedSpace
2817
+ def initialize(parent); end
2818
+
2819
+ def constant_mutator_for(name); end
2820
+ def proxies_of(klass); end
2821
+
2822
+ # @return [Boolean]
2823
+ def registered?(object); end
2824
+
2825
+ private
2826
+
2827
+ def any_instance_recorder_not_found_for(id, klass); end
2828
+ def proxy_not_found_for(id, object); end
2829
+ end
2830
+
2831
+ # @private
2832
+ class RSpec::Mocks::NoCallbackInvocationStrategy
2833
+ def call(_doubled_module); end
2834
+ end
2835
+
2836
+ # @private
2837
+ class RSpec::Mocks::ObjectMethodReference < ::RSpec::Mocks::MethodReference
2838
+ private
2839
+
2840
+ def find_method(object); end
2841
+
2842
+ # @return [Boolean]
2843
+ def method_defined?(object); end
2844
+
2845
+ # @return [Boolean]
2846
+ def method_implemented?(object); end
2847
+
2848
+ def visibility_from(object); end
2849
+
2850
+ class << self
2851
+ def for(object_reference, method_name); end
2852
+ end
2853
+ end
2854
+
2855
+ # @private
2856
+ class RSpec::Mocks::ObjectReference
2857
+ class << self
2858
+ # Returns an appropriate Object or Module reference based
2859
+ # on the given argument.
2860
+ def for(object_module_or_name, allow_direct_object_refs = T.unsafe(nil)); end
2861
+
2862
+ private
2863
+
2864
+ # 1.8.7
2865
+ #
2866
+ # @return [Boolean]
2867
+ def anonymous_module?(mod); end
2868
+
2869
+ def name_of(mod); end
2870
+ end
2871
+ end
2872
+
2873
+ # @private
2874
+ RSpec::Mocks::ObjectReference::MODULE_NAME_METHOD = T.let(T.unsafe(nil), UnboundMethod)
2875
+
2876
+ # Similar to an InstanceVerifyingDouble, except that it verifies against
2877
+ # public methods of the given object.
2878
+ #
2879
+ # @private
2880
+ class RSpec::Mocks::ObjectVerifyingDouble
2881
+ include ::RSpec::Mocks::TestDouble
2882
+ include ::RSpec::Mocks::VerifyingDouble
2883
+ include ::RSpec::Mocks::ObjectVerifyingDoubleMethods
2884
+ end
2885
+
2886
+ # An awkward module necessary because we cannot otherwise have
2887
+ # ClassVerifyingDouble inherit from Module and still share these methods.
2888
+ #
2889
+ # @private
2890
+ module RSpec::Mocks::ObjectVerifyingDoubleMethods
2891
+ include ::RSpec::Mocks::TestDouble
2892
+ include ::RSpec::Mocks::VerifyingDouble
2893
+
2894
+ def as_stubbed_const(options = T.unsafe(nil)); end
2895
+
2896
+ private
2897
+
2898
+ def __build_mock_proxy(order_group); end
2899
+ end
2900
+
2901
+ # @private
2902
+ class RSpec::Mocks::OrderGroup
2903
+ # @return [OrderGroup] a new instance of OrderGroup
2904
+ def initialize; end
2905
+
2906
+ def clear; end
2907
+
2908
+ # @private
2909
+ def consume; end
2910
+
2911
+ # @return [Boolean]
2912
+ def empty?; end
2913
+
2914
+ # @private
2915
+ def handle_order_constraint(expectation); end
2916
+
2917
+ def invoked(message); end
2918
+
2919
+ # @private
2920
+ # @return [Boolean]
2921
+ def ready_for?(expectation); end
2922
+
2923
+ # @private
2924
+ def register(expectation); end
2925
+
2926
+ def verify_invocation_order(expectation); end
2927
+
2928
+ private
2929
+
2930
+ def expectation_for(message); end
2931
+
2932
+ # @return [Boolean]
2933
+ def expectations_invoked_in_order?; end
2934
+
2935
+ def expected_invocations; end
2936
+ def invoked_expectations; end
2937
+ def remaining_expectations; end
2938
+ end
2939
+
2940
+ # Raised when doubles or partial doubles are used outside of the per-test lifecycle.
2941
+ class RSpec::Mocks::OutsideOfExampleError < ::StandardError; end
2942
+
2943
+ # @private
2944
+ class RSpec::Mocks::PartialClassDoubleProxy < ::RSpec::Mocks::PartialDoubleProxy
2945
+ include ::RSpec::Mocks::PartialClassDoubleProxyMethods
2946
+ end
2947
+
2948
+ # When we mock or stub a method on a class, we have to treat it a bit different,
2949
+ # because normally singleton method definitions only affect the object on which
2950
+ # they are defined, but on classes they affect subclasses, too. As a result,
2951
+ # we need some special handling to get the original method.
2952
+ #
2953
+ # @private
2954
+ module RSpec::Mocks::PartialClassDoubleProxyMethods
2955
+ def initialize(source_space, *args); end
2956
+
2957
+ # Consider this situation:
2958
+ #
2959
+ # class A; end
2960
+ # class B < A; end
2961
+ #
2962
+ # allow(A).to receive(:new)
2963
+ # expect(B).to receive(:new).and_call_original
2964
+ #
2965
+ # When getting the original definition for `B.new`, we cannot rely purely on
2966
+ # using `B.method(:new)` before our redefinition is defined on `B`, because
2967
+ # `B.method(:new)` will return a method that will execute the stubbed version
2968
+ # of the method on `A` since singleton methods on classes are in the lookup
2969
+ # hierarchy.
2970
+ #
2971
+ # To do it properly, we need to find the original definition of `new` from `A`
2972
+ # from _before_ `A` was stubbed, and we need to rebind it to `B` so that it will
2973
+ # run with the proper `self`.
2974
+ #
2975
+ # That's what this method (together with `original_unbound_method_handle_from_ancestor_for`)
2976
+ # does.
2977
+ def original_method_handle_for(message); end
2978
+
2979
+ protected
2980
+
2981
+ def method_double_from_ancestor_for(message); end
2982
+ def original_unbound_method_handle_from_ancestor_for(message); end
2983
+ def superclass_proxy; end
2984
+ end
2985
+
2986
+ # @private
2987
+ class RSpec::Mocks::PartialDoubleProxy < ::RSpec::Mocks::Proxy
2988
+ # @private
2989
+ def add_simple_expectation(method_name, response, location); end
2990
+
2991
+ # @private
2992
+ def add_simple_stub(method_name, response); end
2993
+
2994
+ def message_received(message, *args, &block); end
2995
+ def original_method_handle_for(message); end
2996
+ def reset; end
2997
+
2998
+ # @private
2999
+ def visibility_for(method_name); end
3000
+
3001
+ private
3002
+
3003
+ # @return [Boolean]
3004
+ def any_instance_class_recorder_observing_method?(klass, method_name); end
3005
+ end
3006
+
3007
+ # @private
3008
+ class RSpec::Mocks::Proxy
3009
+ # @private
3010
+ # @return [Proxy] a new instance of Proxy
3011
+ def initialize(object, order_group, options = T.unsafe(nil)); end
3012
+
3013
+ # @private
3014
+ def add_message_expectation(method_name, opts = T.unsafe(nil), &block); end
3015
+
3016
+ # @private
3017
+ def add_simple_expectation(method_name, response, location); end
3018
+
3019
+ # @private
3020
+ def add_simple_stub(method_name, response); end
3021
+
3022
+ # @private
3023
+ def add_stub(method_name, opts = T.unsafe(nil), &implementation); end
3024
+
3025
+ # Tells the object to ignore any messages that aren't explicitly set as
3026
+ # stubs or message expectations.
3027
+ #
3028
+ # @private
3029
+ def as_null_object; end
3030
+
3031
+ # @private
3032
+ def build_expectation(method_name); end
3033
+
3034
+ # @private
3035
+ def check_for_unexpected_arguments(expectation); end
3036
+
3037
+ # @private
3038
+ # @raise [ArgumentError]
3039
+ def ensure_can_be_proxied!(object); end
3040
+
3041
+ # @private
3042
+ def ensure_implemented(*_args); end
3043
+
3044
+ # @private
3045
+ # @return [Boolean]
3046
+ def has_negative_expectation?(message); end
3047
+
3048
+ # @private
3049
+ def message_received(message, *args, &block); end
3050
+
3051
+ # @private
3052
+ def messages_arg_list; end
3053
+
3054
+ # @private
3055
+ def method_double_if_exists_for_message(message); end
3056
+
3057
+ # @private
3058
+ # @return [Boolean]
3059
+ def null_object?; end
3060
+
3061
+ # @private
3062
+ def object; end
3063
+
3064
+ # @private
3065
+ def original_method_handle_for(_message); end
3066
+
3067
+ def prepended_modules_of_singleton_class; end
3068
+
3069
+ # @private
3070
+ def raise_missing_default_stub_error(expectation, args_for_multiple_calls); end
3071
+
3072
+ # @private
3073
+ def raise_unexpected_message_error(method_name, args); end
3074
+
3075
+ # @private
3076
+ # @return [Boolean]
3077
+ def received_message?(method_name, *args, &block); end
3078
+
3079
+ # @private
3080
+ def record_message_received(message, *args, &block); end
3081
+
3082
+ # @private
3083
+ def remove_stub(method_name); end
3084
+
3085
+ # @private
3086
+ def remove_stub_if_present(method_name); end
3087
+
3088
+ # @private
3089
+ def replay_received_message_on(expectation, &block); end
3090
+
3091
+ # @private
3092
+ def reset; end
3093
+
3094
+ # @private
3095
+ def verify; end
3096
+
3097
+ # @private
3098
+ def visibility_for(_method_name); end
3099
+
3100
+ private
3101
+
3102
+ def find_almost_matching_expectation(method_name, *args); end
3103
+ def find_almost_matching_stub(method_name, *args); end
3104
+ def find_best_matching_expectation_for(method_name); end
3105
+ def find_matching_expectation(method_name, *args); end
3106
+ def find_matching_method_stub(method_name, *args); end
3107
+ def method_double_for(message); end
3108
+
3109
+ class << self
3110
+ def prepended_modules_of(klass); end
3111
+ end
3112
+ end
3113
+
3114
+ RSpec::Mocks::Proxy::DEFAULT_MESSAGE_EXPECTATION_OPTS = T.let(T.unsafe(nil), Hash)
3115
+
3116
+ # @private
3117
+ class RSpec::Mocks::Proxy::SpecificMessage < ::Struct
3118
+ def ==(expectation); end
3119
+
3120
+ # Returns the value of attribute args
3121
+ #
3122
+ # @return [Object] the current value of args
3123
+ def args; end
3124
+
3125
+ # Sets the attribute args
3126
+ #
3127
+ # @param value [Object] the value to set the attribute args to.
3128
+ # @return [Object] the newly set value
3129
+ def args=(_); end
3130
+
3131
+ # Returns the value of attribute message
3132
+ #
3133
+ # @return [Object] the current value of message
3134
+ def message; end
3135
+
3136
+ # Sets the attribute message
3137
+ #
3138
+ # @param value [Object] the value to set the attribute message to.
3139
+ # @return [Object] the newly set value
3140
+ def message=(_); end
3141
+
3142
+ # Returns the value of attribute object
3143
+ #
3144
+ # @return [Object] the current value of object
3145
+ def object; end
3146
+
3147
+ # Sets the attribute object
3148
+ #
3149
+ # @param value [Object] the value to set the attribute object to.
3150
+ # @return [Object] the newly set value
3151
+ def object=(_); end
3152
+
3153
+ class << self
3154
+ def [](*_arg0); end
3155
+ def inspect; end
3156
+ def members; end
3157
+ def new(*_arg0); end
3158
+ end
3159
+ end
3160
+
3161
+ # @private
3162
+ class RSpec::Mocks::ProxyForNil < ::RSpec::Mocks::PartialDoubleProxy
3163
+ # @return [ProxyForNil] a new instance of ProxyForNil
3164
+ def initialize(order_group); end
3165
+
3166
+ def add_message_expectation(method_name, opts = T.unsafe(nil), &block); end
3167
+ def add_stub(method_name, opts = T.unsafe(nil), &implementation); end
3168
+
3169
+ # Returns the value of attribute disallow_expectations.
3170
+ def disallow_expectations; end
3171
+
3172
+ # Sets the attribute disallow_expectations
3173
+ #
3174
+ # @param value the value to set the attribute disallow_expectations to.
3175
+ def disallow_expectations=(_arg0); end
3176
+
3177
+ # Returns the value of attribute warn_about_expectations.
3178
+ def warn_about_expectations; end
3179
+
3180
+ # Sets the attribute warn_about_expectations
3181
+ #
3182
+ # @param value the value to set the attribute warn_about_expectations to.
3183
+ def warn_about_expectations=(_arg0); end
3184
+
3185
+ private
3186
+
3187
+ def raise_error(method_name); end
3188
+ def set_expectation_behavior; end
3189
+ def warn(method_name); end
3190
+ def warn_or_raise!(method_name); end
3191
+ end
3192
+
3193
+ # Provides a default space implementation for outside
3194
+ # the scope of an example. Called "root" because it serves
3195
+ # as the root of the space stack.
3196
+ #
3197
+ # @private
3198
+ class RSpec::Mocks::RootSpace
3199
+ def any_instance_proxy_for(*_args); end
3200
+ def any_instance_recorder_for(*_args); end
3201
+ def any_instance_recorders_from_ancestry_of(_object); end
3202
+ def new_scope; end
3203
+ def proxy_for(*_args); end
3204
+ def register_constant_mutator(_mutator); end
3205
+
3206
+ # @return [Boolean]
3207
+ def registered?(_object); end
3208
+
3209
+ def reset_all; end
3210
+ def superclass_proxy_for(*_args); end
3211
+ def verify_all; end
3212
+
3213
+ private
3214
+
3215
+ # @raise [OutsideOfExampleError]
3216
+ def raise_lifecycle_message; end
3217
+ end
3218
+
3219
+ # A message expectation that only allows concrete return values to be set
3220
+ # for a message. While this same effect can be achieved using a standard
3221
+ # MessageExpectation, this version is much faster and so can be used as an
3222
+ # optimization.
3223
+ #
3224
+ # @private
3225
+ class RSpec::Mocks::SimpleMessageExpectation
3226
+ # @return [SimpleMessageExpectation] a new instance of SimpleMessageExpectation
3227
+ def initialize(message, response, error_generator, backtrace_line = T.unsafe(nil)); end
3228
+
3229
+ # @return [Boolean]
3230
+ def called_max_times?; end
3231
+
3232
+ def invoke(*_); end
3233
+
3234
+ # @return [Boolean]
3235
+ def matches?(message, *_); end
3236
+
3237
+ def unadvise(_); end
3238
+ def verify_messages_received; end
3239
+ end
3240
+
3241
+ # @private
3242
+ class RSpec::Mocks::Space
3243
+ # @return [Space] a new instance of Space
3244
+ def initialize; end
3245
+
3246
+ # Returns the value of attribute any_instance_mutex.
3247
+ def any_instance_mutex; end
3248
+
3249
+ def any_instance_proxy_for(klass); end
3250
+ def any_instance_recorder_for(klass, only_return_existing = T.unsafe(nil)); end
3251
+
3252
+ # Returns the value of attribute any_instance_recorders.
3253
+ def any_instance_recorders; end
3254
+
3255
+ def any_instance_recorders_from_ancestry_of(object); end
3256
+ def constant_mutator_for(name); end
3257
+ def ensure_registered(object); end
3258
+ def new_scope; end
3259
+
3260
+ # Returns the value of attribute proxies.
3261
+ def proxies; end
3262
+
3263
+ def proxies_of(klass); end
3264
+ def proxy_for(object); end
3265
+
3266
+ # Returns the value of attribute proxy_mutex.
3267
+ def proxy_mutex; end
3268
+
3269
+ def register_constant_mutator(mutator); end
3270
+
3271
+ # @return [Boolean]
3272
+ def registered?(object); end
3273
+
3274
+ def reset_all; end
3275
+ def superclass_proxy_for(klass); end
3276
+ def verify_all; end
3277
+
3278
+ private
3279
+
3280
+ def any_instance_recorder_not_found_for(id, klass); end
3281
+ def class_proxy_with_callback_verification_strategy(object, strategy); end
3282
+ def id_for(object); end
3283
+ def new_mutex; end
3284
+ def proxy_not_found_for(id, object); end
3285
+ def superclass_proxy_not_found_for(id, object); end
3286
+ end
3287
+
3288
+ # @private
3289
+ class RSpec::Mocks::StubChain < ::RSpec::Mocks::MessageChain
3290
+ private
3291
+
3292
+ def expectation(object, message, &return_block); end
3293
+
3294
+ class << self
3295
+ def stub_chain_on(object, *chain, &blk); end
3296
+ end
3297
+ end
3298
+
3299
+ # Provides methods for enabling and disabling the available syntaxes
3300
+ # provided by rspec-mocks.
3301
+ #
3302
+ # @api private
3303
+ module RSpec::Mocks::Syntax
3304
+ class << self
3305
+ # Determines where the methods like `should_receive`, and `stub` are added.
3306
+ #
3307
+ # @api private
3308
+ def default_should_syntax_host; end
3309
+
3310
+ # Disables the expect syntax (`expect(dbl).to receive`, `allow(dbl).to receive`, etc).
3311
+ #
3312
+ # @api private
3313
+ def disable_expect(syntax_host = T.unsafe(nil)); end
3314
+
3315
+ # Disables the should syntax (`dbl.stub`, `dbl.should_receive`, etc).
3316
+ #
3317
+ # @api private
3318
+ def disable_should(syntax_host = T.unsafe(nil)); end
3319
+
3320
+ # Enables the expect syntax (`expect(dbl).to receive`, `allow(dbl).to receive`, etc).
3321
+ #
3322
+ # @api private
3323
+ def enable_expect(syntax_host = T.unsafe(nil)); end
3324
+
3325
+ # Enables the should syntax (`dbl.stub`, `dbl.should_receive`, etc).
3326
+ #
3327
+ # @api private
3328
+ def enable_should(syntax_host = T.unsafe(nil)); end
3329
+
3330
+ # Indicates whether or not the expect syntax is enabled.
3331
+ #
3332
+ # @api private
3333
+ # @return [Boolean]
3334
+ def expect_enabled?(syntax_host = T.unsafe(nil)); end
3335
+
3336
+ # Indicates whether or not the should syntax is enabled.
3337
+ #
3338
+ # @api private
3339
+ # @return [Boolean]
3340
+ def should_enabled?(syntax_host = T.unsafe(nil)); end
3341
+
3342
+ # @api private
3343
+ # @private
3344
+ def warn_about_should!; end
3345
+
3346
+ # @api private
3347
+ # @private
3348
+ def warn_unless_should_configured(method_name, replacement = T.unsafe(nil)); end
3349
+ end
3350
+ end
3351
+
3352
+ # @private
3353
+ class RSpec::Mocks::TargetBase
3354
+ include ::RSpec::Mocks::TargetDelegationInstanceMethods
3355
+ extend ::RSpec::Mocks::TargetDelegationClassMethods
3356
+
3357
+ # @return [TargetBase] a new instance of TargetBase
3358
+ def initialize(target); end
3359
+ end
3360
+
3361
+ # @private
3362
+ module RSpec::Mocks::TargetDelegationClassMethods
3363
+ def delegate_not_to(matcher_method, options = T.unsafe(nil)); end
3364
+ def delegate_to(matcher_method); end
3365
+ def disallow_negation(method_name); end
3366
+ end
3367
+
3368
+ # @private
3369
+ module RSpec::Mocks::TargetDelegationInstanceMethods
3370
+ # Returns the value of attribute target.
3371
+ def target; end
3372
+
3373
+ private
3374
+
3375
+ def define_matcher(matcher, name, &block); end
3376
+
3377
+ # @return [Boolean]
3378
+ def matcher_allowed?(matcher); end
3379
+
3380
+ # @raise [NegationUnsupportedError]
3381
+ def raise_negation_unsupported(method_name, matcher); end
3382
+
3383
+ # @raise [UnsupportedMatcherError]
3384
+ def raise_unsupported_matcher(method_name, matcher); end
3385
+ end
3386
+
3387
+ # Implements the methods needed for a pure test double. RSpec::Mocks::Double
3388
+ # includes this module, and it is provided for cases where you want a
3389
+ # pure test double without subclassing RSpec::Mocks::Double.
3390
+ module RSpec::Mocks::TestDouble
3391
+ # Creates a new test double with a `name` (that will be used in error
3392
+ # messages only)
3393
+ def initialize(name = T.unsafe(nil), stubs = T.unsafe(nil)); end
3394
+
3395
+ # This allows for comparing the mock to other objects that proxy such as
3396
+ # ActiveRecords belongs_to proxy objects. By making the other object run
3397
+ # the comparison, we're sure the call gets delegated to the proxy
3398
+ # target.
3399
+ def ==(other); end
3400
+
3401
+ # @private
3402
+ def __build_mock_proxy_unless_expired(order_group); end
3403
+
3404
+ # @private
3405
+ def __disallow_further_usage!; end
3406
+
3407
+ # Tells the object to respond to all messages. If specific stub values
3408
+ # are declared, they'll work as expected. If not, the receiver is
3409
+ # returned.
3410
+ def as_null_object; end
3411
+
3412
+ # Override for default freeze implementation to prevent freezing of test
3413
+ # doubles.
3414
+ def freeze; end
3415
+
3416
+ # @private
3417
+ def inspect; end
3418
+
3419
+ # Returns true if this object has received `as_null_object`
3420
+ #
3421
+ # @return [Boolean]
3422
+ def null_object?; end
3423
+
3424
+ # @private
3425
+ # @return [Boolean]
3426
+ def respond_to?(message, incl_private = T.unsafe(nil)); end
3427
+
3428
+ # @private
3429
+ def to_s; end
3430
+
3431
+ private
3432
+
3433
+ def __build_mock_proxy(order_group); end
3434
+ def __mock_proxy; end
3435
+ def __raise_expired_error; end
3436
+ def assign_stubs(stubs); end
3437
+ def initialize_copy(other); end
3438
+
3439
+ # @raise [NoMethodError]
3440
+ def method_missing(message, *args, &block); end
3441
+ end
3442
+
3443
+ # @private
3444
+ module RSpec::Mocks::TestDoubleFormatter
3445
+ class << self
3446
+ def format(dbl, unwrap = T.unsafe(nil)); end
3447
+
3448
+ private
3449
+
3450
+ def name_desc(dbl); end
3451
+ def type_desc(dbl); end
3452
+ def verified_module_desc(dbl); end
3453
+ end
3454
+ end
3455
+
3456
+ # @private
3457
+ class RSpec::Mocks::TestDoubleProxy < ::RSpec::Mocks::Proxy
3458
+ def reset; end
3459
+ end
3460
+
3461
+ # @private
3462
+ class RSpec::Mocks::UnsupportedMatcherError < ::StandardError; end
3463
+
3464
+ # @private
3465
+ module RSpec::Mocks::VerifyingDouble
3466
+ def initialize(doubled_module, *args); end
3467
+
3468
+ def __send__(name, *args, &block); end
3469
+ def method_missing(message, *args, &block); end
3470
+
3471
+ # @return [Boolean]
3472
+ def respond_to?(message, include_private = T.unsafe(nil)); end
3473
+
3474
+ def send(name, *args, &block); end
3475
+ end
3476
+
3477
+ # @private
3478
+ class RSpec::Mocks::VerifyingDoubleNotDefinedError < ::StandardError; end
3479
+
3480
+ # Used in place of a `VerifyingExistingMethodDouble` for the specific case
3481
+ # of mocking or stubbing a `new` method on a class. In this case, we substitute
3482
+ # the method signature from `#initialize` since new's signature is just `*args`.
3483
+ #
3484
+ # @private
3485
+ class RSpec::Mocks::VerifyingExistingClassNewMethodDouble < ::RSpec::Mocks::VerifyingExistingMethodDouble
3486
+ # @yield [Support::MethodSignature.new(object.instance_method(:initialize))]
3487
+ def with_signature; end
3488
+ end
3489
+
3490
+ # A VerifyingMethodDouble fetches the method to verify against from the
3491
+ # original object, using a MethodReference. This works for pure doubles,
3492
+ # but when the original object is itself the one being modified we need to
3493
+ # collapse the reference and the method double into a single object so that
3494
+ # we can access the original pristine method definition.
3495
+ #
3496
+ # @private
3497
+ class RSpec::Mocks::VerifyingExistingMethodDouble < ::RSpec::Mocks::VerifyingMethodDouble
3498
+ # @return [VerifyingExistingMethodDouble] a new instance of VerifyingExistingMethodDouble
3499
+ def initialize(object, method_name, proxy); end
3500
+
3501
+ # @return [Boolean]
3502
+ def unimplemented?; end
3503
+
3504
+ # @yield [Support::MethodSignature.new(original_implementation_callable)]
3505
+ def with_signature; end
3506
+
3507
+ class << self
3508
+ def for(object, method_name, proxy); end
3509
+ end
3510
+ end
3511
+
3512
+ # A message expectation that knows about the real implementation of the
3513
+ # message being expected, so that it can verify that any expectations
3514
+ # have the valid arguments.
3515
+ #
3516
+ # @api private
3517
+ class RSpec::Mocks::VerifyingMessageExpectation < ::RSpec::Mocks::MessageExpectation
3518
+ # @api private
3519
+ # @return [VerifyingMessageExpectation] a new instance of VerifyingMessageExpectation
3520
+ def initialize(*args); end
3521
+
3522
+ # A level of indirection is used here rather than just passing in the
3523
+ # method itself, since method look up is expensive and we only want to
3524
+ # do it if actually needed.
3525
+ #
3526
+ # Conceptually the method reference makes more sense as a constructor
3527
+ # argument since it should be immutable, but it is significantly more
3528
+ # straight forward to build the object in pieces so for now it stays as
3529
+ # an accessor.
3530
+ #
3531
+ # @api private
3532
+ def method_reference; end
3533
+
3534
+ # A level of indirection is used here rather than just passing in the
3535
+ # method itself, since method look up is expensive and we only want to
3536
+ # do it if actually needed.
3537
+ #
3538
+ # Conceptually the method reference makes more sense as a constructor
3539
+ # argument since it should be immutable, but it is significantly more
3540
+ # straight forward to build the object in pieces so for now it stays as
3541
+ # an accessor.
3542
+ #
3543
+ # @api private
3544
+ def method_reference=(_arg0); end
3545
+
3546
+ # @api private
3547
+ # @private
3548
+ def with(*args, &block); end
3549
+
3550
+ private
3551
+
3552
+ # @api private
3553
+ def validate_expected_arguments!; end
3554
+ end
3555
+
3556
+ # @private
3557
+ class RSpec::Mocks::VerifyingMethodDouble < ::RSpec::Mocks::MethodDouble
3558
+ # @return [VerifyingMethodDouble] a new instance of VerifyingMethodDouble
3559
+ def initialize(object, method_name, proxy, method_reference); end
3560
+
3561
+ def add_expectation(*args, &block); end
3562
+ def add_stub(*args, &block); end
3563
+ def message_expectation_class; end
3564
+ def proxy_method_invoked(obj, *args, &block); end
3565
+ def validate_arguments!(actual_args); end
3566
+ end
3567
+
3568
+ # @private
3569
+ class RSpec::Mocks::VerifyingPartialClassDoubleProxy < ::RSpec::Mocks::VerifyingPartialDoubleProxy
3570
+ include ::RSpec::Mocks::PartialClassDoubleProxyMethods
3571
+ end
3572
+
3573
+ # @private
3574
+ class RSpec::Mocks::VerifyingPartialDoubleProxy < ::RSpec::Mocks::PartialDoubleProxy
3575
+ include ::RSpec::Mocks::VerifyingProxyMethods
3576
+
3577
+ # @return [VerifyingPartialDoubleProxy] a new instance of VerifyingPartialDoubleProxy
3578
+ def initialize(object, expectation_ordering, optional_callback_invocation_strategy = T.unsafe(nil)); end
3579
+
3580
+ def ensure_implemented(_method_name); end
3581
+ def method_reference; end
3582
+ end
3583
+
3584
+ # A verifying proxy mostly acts like a normal proxy, except that it
3585
+ # contains extra logic to try and determine the validity of any expectation
3586
+ # set on it. This includes whether or not methods have been defined and the
3587
+ # validatiy of arguments on method calls.
3588
+ #
3589
+ # In all other ways this behaves like a normal proxy. It only adds the
3590
+ # verification behaviour to specific methods then delegates to the parent
3591
+ # implementation.
3592
+ #
3593
+ # These checks are only activated if the doubled class has already been
3594
+ # loaded, otherwise they are disabled. This allows for testing in
3595
+ # isolation.
3596
+ #
3597
+ # @private
3598
+ class RSpec::Mocks::VerifyingProxy < ::RSpec::Mocks::TestDoubleProxy
3599
+ include ::RSpec::Mocks::VerifyingProxyMethods
3600
+
3601
+ # @return [VerifyingProxy] a new instance of VerifyingProxy
3602
+ def initialize(object, order_group, doubled_module, method_reference_class); end
3603
+
3604
+ def method_reference; end
3605
+ def validate_arguments!(method_name, args); end
3606
+ def visibility_for(method_name); end
3607
+ end
3608
+
3609
+ # @private
3610
+ module RSpec::Mocks::VerifyingProxyMethods
3611
+ def add_message_expectation(method_name, opts = T.unsafe(nil), &block); end
3612
+ def add_simple_stub(method_name, *args); end
3613
+ def add_stub(method_name, opts = T.unsafe(nil), &implementation); end
3614
+ def ensure_implemented(method_name); end
3615
+ def ensure_publicly_implemented(method_name, _object); end
3616
+ end
3617
+
3618
+ # Version information for RSpec mocks.
3619
+ module RSpec::Mocks::Version; end
3620
+
3621
+ # Version of RSpec mocks currently in use in SemVer format.
3622
+ RSpec::Mocks::Version::STRING = T.let(T.unsafe(nil), String)
3623
+
3624
+ # @private
3625
+ RSpec::SharedContext = RSpec::Core::SharedContext