Sha256: 50a4859dfde793815811552157b478200ac3e357f888abc581b96fe0e967c8a9
Contents?: true
Size: 962 Bytes
Versions: 46
Compression:
Stored size: 962 Bytes
Contents
module Mocha # :nodoc: class ExpectationList def initialize @expectations = [] end def add(expectation) @expectations << expectation end def respond_to?(method_name) @expectations.any? { |expectation| expectation.method_name == method_name } end def detect(method_name, *arguments) expectations = @expectations.reverse.select { |expectation| expectation.match?(method_name, *arguments) } expectation = expectations.detect { |expectation| expectation.invocations_allowed? } expectation || expectations.first end def similar(method_name) @expectations.select { |expectation| expectation.method_name == method_name } end def verify(&block) @expectations.each { |expectation| expectation.verify(&block) } end def to_a @expectations end def to_set @expectations.to_set end def size @expectations.size end end end
Version data entries
46 entries across 46 versions & 3 rubygems