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

Version Path
redcar-dev-0.12.1dev-java lib/openssl/mocha/lib/mocha/expectation_list.rb
redcar-dev-0.12.0dev-java lib/openssl/mocha/lib/mocha/expectation_list.rb
redcar-0.11 lib/openssl/mocha/lib/mocha/expectation_list.rb
redcar-0.11.0dev lib/openssl/mocha/lib/mocha/expectation_list.rb
redcar-0.10 lib/openssl/mocha/lib/mocha/expectation_list.rb
redcar-0.9.2 lib/openssl/mocha/lib/mocha/expectation_list.rb
redcar-0.9.1 lib/openssl/mocha/lib/mocha/expectation_list.rb
redcar-0.9.0 lib/openssl/mocha/lib/mocha/expectation_list.rb
redcar-0.8.1 lib/openssl/mocha/lib/mocha/expectation_list.rb
redcar-0.8 lib/openssl/mocha/lib/mocha/expectation_list.rb
redcar-0.7 lib/openssl/mocha/lib/mocha/expectation_list.rb
redcar-0.6.1 lib/openssl/mocha/lib/mocha/expectation_list.rb
redcar-0.6 lib/openssl/mocha/lib/mocha/expectation_list.rb
redcar-0.6.1dev lib/openssl/mocha/lib/mocha/expectation_list.rb
redcar-0.5.1 lib/openssl/mocha/lib/mocha/expectation_list.rb
redcar-0.5 lib/openssl/mocha/lib/mocha/expectation_list.rb
redcar-0.5.6dev lib/openssl/mocha/lib/mocha/expectation_list.rb
redcar-0.5.5dev lib/openssl/mocha/lib/mocha/expectation_list.rb
redcar-0.5.4dev lib/openssl/mocha/lib/mocha/expectation_list.rb
redcar-0.5.3dev lib/openssl/mocha/lib/mocha/expectation_list.rb