class RSpec::Mocks::AnyInstance::Chain
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(*args, &block)
def initialize(*args, &block) @expectation_args = args @expectation_block = block end
def last_message
def last_message messages.last.first.first unless messages.empty? end
def messages
def messages @messages ||= [] end
def negated?
def negated? messages.any? { |(message, *_), _| message.to_sym == :never } end
def never
def never ErrorGenerator.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