class RSpec::Mocks::VerifyingMethodDouble
@api private
def add_expectation(*arg)
def add_expectation(*arg) super.tap { |x| x.method_reference = @method_reference } end
def ensure_arity!(arity)
def ensure_arity!(arity) @method_reference.when_defined do |method| calculator = ArityCalculator.new(method) unless calculator.within_range?(arity) raise ArgumentError, "wrong number of arguments (#{arity} for #{method.arity})" end end end
def initialize(object, method_name, proxy, method_reference)
def initialize(object, method_name, proxy, method_reference) super(object, method_name, proxy) @method_reference = method_reference end
def message_expectation_class
def message_expectation_class VerifyingMessageExpectation end
def proxy_method_invoked(obj, *args, &block)
def proxy_method_invoked(obj, *args, &block) ensure_arity!(args.length) super end