class RSpec::Mocks::VerifyingMessageExpectation
@api private
have the valid arguments.
message being expected, so that it can verify that any expectations
A message expectation that knows about the real implementation of the
def initialize(*args)
def initialize(*args) super end
def validate_arguments!(actual_args)
def validate_arguments!(actual_args) return if method_reference.nil? method_reference.with_signature do |signature| verifier = Support::MethodSignatureVerifier.new(signature, actual_args) unless verifier.valid? # Fail fast is required, otherwise the message expecation will fail # as well ("expected method not called") and clobber this one. @failed_fast = true @error_generator.raise_invalid_arguments_error(verifier) end end end
def with(*args, &block)
- Private: -
def with(*args, &block) unless ArgumentMatchers::AnyArgsMatcher === args.first expected_args = if ArgumentMatchers::NoArgsMatcher === args.first [] elsif args.length > 0 args else # No arguments given, this will raise. super end validate_arguments!(expected_args) end super end