Class: RSpec::Mocks::VerifyingMessageExpectation Private

Inherits:
MessageExpectation show all
Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-mocks-3.12.2/lib/rspec/mocks/verifying_message_expectation.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

A message expectation that knows about the real implementation of the message being expected, so that it can verify that any expectations have the valid arguments.

Instance Attribute Summary collapse

Attributes included from MessageExpectation::ImplementationDetails

#argument_list_matcher, #error_generator, #implementation, #message, #orig_object, #type

Instance Method Summary collapse

Methods inherited from MessageExpectation

#and_call_original, #and_invoke, #and_raise, #and_return, #and_throw, #and_wrap_original, #and_yield, #at_least, #at_most, #exactly, #never, #once, #ordered, #thrice, #times, #to_s, #twice

Methods included from MessageExpectation::ImplementationDetails

#actual_received_count_matters?, #additional_expected_calls, #advise, #and_yield_receiver_to_implementation, #called_max_times?, #description_for, #ensure_expected_ordering_received!, #expectation_count_type, #expected_args, #expected_messages_received?, #generate_error, #ignoring_args?, #increase_actual_received_count!, #invoke, #invoke_without_incrementing_received_count, #matches?, #matches_at_least_count?, #matches_at_most_count?, #matches_exact_count?, #matches_name_but_not_args, #negative?, #negative_expectation_for?, #ordered?, #raise_out_of_order_error, #raise_unexpected_message_args_error, #safe_invoke, #similar_messages, #unadvise, #verify_messages_received, #yield_receiver_to_implementation_block?

Constructor Details

#initialize(*args) ⇒ VerifyingMessageExpectation

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of VerifyingMessageExpectation.



20
21
22
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-mocks-3.12.2/lib/rspec/mocks/verifying_message_expectation.rb', line 20

def initialize(*args)
  super
end

Instance Attribute Details

#method_referenceObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

A level of indirection is used here rather than just passing in the method itself, since method look up is expensive and we only want to do it if actually needed.

Conceptually the method reference makes more sense as a constructor argument since it should be immutable, but it is significantly more straight forward to build the object in pieces so for now it stays as an accessor.



18
19
20
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-mocks-3.12.2/lib/rspec/mocks/verifying_message_expectation.rb', line 18

def method_reference
  @method_reference
end

Instance Method Details

#with(*args, &block) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



25
26
27
28
29
30
31
32
33
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-mocks-3.12.2/lib/rspec/mocks/verifying_message_expectation.rb', line 25

def with(*args, &block)
  super(*args, &block).tap do
    validate_expected_arguments! do |signature|
      example_call_site_args = [:an_arg] * signature.min_non_kw_args
      example_call_site_args << :kw_args_hash if signature.required_kw_args.any?
      @argument_list_matcher.resolve_expected_args_based_on(example_call_site_args)
    end
  end
end