class Mocha::ExpectationList
def +(other)
def +(other) self.class.new(to_a + other.to_a) end
def add(expectation)
def add(expectation) @expectations.unshift(expectation) expectation end
def any?
def any? @expectations.any? end
def initialize(expectations = [])
def initialize(expectations = []) @expectations = expectations end
def length
def length @expectations.length end
def match(invocation, ignoring_order: false)
def match(invocation, ignoring_order: false) matching_expectations(invocation, ignoring_order: ignoring_order).first end
def match_allowing_invocation(invocation)
def match_allowing_invocation(invocation) matching_expectations(invocation).detect(&:invocations_allowed?) end
def match_but_out_of_order(invocation)
def match_but_out_of_order(invocation) matching_expectations(invocation).first end
def matches_method?(method_name)
def matches_method?(method_name) @expectations.any? { |expectation| expectation.matches_method?(method_name) } end
def matching_expectations(invocation, ignoring_order: false)
def matching_expectations(invocation, ignoring_order: false) @expectations.select { |e| e.match?(invocation, ignoring_order: ignoring_order) } end
def remove_all_matching_method(method_name)
def remove_all_matching_method(method_name) @expectations.reject! { |expectation| expectation.matches_method?(method_name) } end
def to_a
def to_a @expectations end
def to_set
def to_set @expectations.to_set end
def verified?(assertion_counter = nil)
def verified?(assertion_counter = nil) @expectations.all? { |expectation| expectation.verified?(assertion_counter) } end