class RSpec::Mocks::AnyInstance::Chain
@private
def constrained_to_any_of?(*constraints)
- Private: -
def constrained_to_any_of?(*constraints) constraints.any? do |constraint| messages.any? do |message| message.first.first == constraint end end end
def expectation_fulfilled!
- Private: -
def expectation_fulfilled! @expectation_fulfilled = true end
def initialize(recorder, *args, &block)
def initialize(recorder, *args, &block) @recorder = recorder @expectation_args = args @expectation_block = block @argument_list_matcher = ArgumentListMatcher::MATCH_ALL end
def last_message
def last_message messages.last.first.first unless messages.empty? end
def matches_args?(*args)
- Private: -
def matches_args?(*args) @argument_list_matcher.args_match?(*args) end
def messages
def messages @messages ||= [] end
def negated?
def negated? messages.any? { |(message, *_), _| message == :never } end
def never
def never AnyInstance.error_generator.raise_double_negation_error("expect_any_instance_of(MyClass)") if negated? super end
def playback!(instance)
- Private: -
def playback!(instance) message_expectation = create_message_expectation_on(instance) messages.inject(message_expectation) do |object, message| object.__send__(*message.first, &message.last) end end
def record(rspec_method_name, *args, &block)
def record(rspec_method_name, *args, &block) verify_invocation_order(rspec_method_name, *args, &block) messages << [args.unshift(rspec_method_name), block] self end
def with(*args, &block)
def with(*args, &block) @argument_list_matcher = ArgumentListMatcher.new(*args) super end