Class: Mocha::ExpectationList

### Home Classes Methods

### In Files

- lib/mocha/expectation_list.rb

### Parent

Object

### Methods

- ::new
- #add
- #length
- #match
- #match_allowing_invocation
- #matches_method?
- #to_a
- #to_set
- #verified?

### Files

- COPYING
- README

### Class/Module Index

Quicksearch

- Mocha
- Mocha::API
- Mocha::AnyInstanceMethod
- Mocha::ArgumentIterator
- Mocha::ArrayMethods
- Mocha::BacktraceFilter
- Mocha::Cardinality
- Mocha::Central
- Mocha::ChangeStateSideEffect
- Mocha::ClassMethod
- Mocha::ClassMethods
- Mocha::Configuration
- Mocha::DateMethods
- Mocha::DefaultName
- Mocha::Deprecation
- Mocha::Expectation
- Mocha::ExpectationError
- Mocha::ExpectationList
- Mocha::HashMethods
- Mocha::ImpersonatingAnyInstanceName
- Mocha::ImpersonatingName
- Mocha::InStateOrderingConstraint
- Mocha::InstanceMethod
- Mocha::Integration
- Mocha::Integration::MiniTest
- Mocha::Integration::MiniTest::AssertionCounter
- Mocha::Integration::MiniTest::Version131AndAbove
- Mocha::Integration::TestUnit
- Mocha::Integration::TestUnit::AssertionCounter
- Mocha::Integration::TestUnit::GemVersion200
- Mocha::Integration::TestUnit::GemVersion201AndAbove
- Mocha::Integration::TestUnit::RubyVersion185AndBelow
- Mocha::Integration::TestUnit::RubyVersion186AndAbove
- Mocha::Logger
- Mocha::MethodMatcher
- Mocha::Mock
- Mocha::Mockery
- Mocha::ModuleMethod
- Mocha::Name
- Mocha::ObjectMethods
- Mocha::ParameterMatchers
- Mocha::ParametersMatcher
- Mocha::PrettyParameters
- Mocha::Sequence
- Mocha::Sequence::InSequenceOrderingConstraint
- Mocha::StateMachine
- Mocha::StringMethods
- Mocha::StubbingError
- Mocha::TimeMethods
- Mocha::UnexpectedInvocation
- MiniTest
- MiniTest::Unit
- MiniTest::Unit::TestCase
- Test
- Test::Unit
- Test::Unit::TestCase
- Array
- Date
- Hash
- Object
- String
- Time

No matching classes.

# Mocha::ExpectationList

### Public Class Methods

new() click to toggle source

    # File lib/mocha/expectation_list.rb, line 5
    def initialize
      @expectations = []
    end

### Public Instance Methods

add(expectation) click to toggle source

    # File lib/mocha/expectation_list.rb, line 9
    def add(expectation)
      @expectations.unshift(expectation)
      expectation
    end

length() click to toggle source

    # File lib/mocha/expectation_list.rb, line 38
    def length
      @expectations.length
    end

match(method_name, *arguments) click to toggle source

    # File lib/mocha/expectation_list.rb, line 18
    def match(method_name, *arguments)
      matching_expectations(method_name, *arguments).first
    end

match_allowing_invocation(method_name, *arguments) click to toggle source

    # File lib/mocha/expectation_list.rb, line 22
    def match_allowing_invocation(method_name, *arguments)
      matching_expectations(method_name, *arguments).detect { |e| e.invocations_allowed? }
    end

matches_method?(method_name) click to toggle source

    # File lib/mocha/expectation_list.rb, line 14
    def matches_method?(method_name)
      @expectations.any? { |expectation| expectation.matches_method?(method_name) }
    end

to_a() click to toggle source

    # File lib/mocha/expectation_list.rb, line 30
    def to_a
      @expectations
    end

to_set() click to toggle source

    # File lib/mocha/expectation_list.rb, line 34
    def to_set
      @expectations.to_set
    end

verified?(assertion_counter = nil) click to toggle source

    # File lib/mocha/expectation_list.rb, line 26
    def verified?(assertion_counter = nil)
      @expectations.all? { |expectation| expectation.verified?(assertion_counter) }
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.