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 last_message
def last_message messages.last.first.first unless messages.empty? end
def messages
def messages @messages ||= [] end
def playback!(instance)
- Private: -
def playback!(instance) messages.inject(instance) do |_instance, message| _instance.__send__(*message.first, &message.last) end end
def record(method_name)
- See: RSpec::Mocks::MessageExpectation#$1 -
def record(method_name) class_eval(<<-EOM, __FILE__, __LINE__) def #{method_name}(*args, &block) record(:#{method_name}, *args, &block) end EOM 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