Class: FlexMock::CompositeExpectation

### Home Classes Methods

### In Files

- lib/flexmock/composite_expectation.rb

### Parent

Object

### Methods

- ::new
- #add
- #method_missing
- #mock
- #order_number
- #should_receive
- #to_s

### Files

- CHANGES
- GoogleExample.rdoc
- rspec_examples_spec.rdoc
- test_unit_examples_test.rdoc
- index.rdoc
- flexmock-0.4.0.rdoc
- flexmock-0.4.1.rdoc
- flexmock-0.4.2.rdoc
- flexmock-0.4.3.rdoc
- flexmock-0.5.0.rdoc
- flexmock-0.5.1.rdoc
- flexmock-0.6.0.rdoc
- flexmock-0.6.1.rdoc
- flexmock-0.6.2.rdoc
- flexmock-0.6.3.rdoc
- flexmock-0.6.4.rdoc
- flexmock-0.7.0.rdoc
- flexmock-0.7.1.rdoc
- flexmock-0.8.0.rdoc
- flexmock-0.8.2.rdoc
- flexmock-0.8.3.rdoc
- flexmock-0.8.4.rdoc
- flexmock-0.8.5.rdoc
- flexmock-0.9.0.rdoc
- flexmock-1.0.0.rdoc
- flexmock-1.0.3.rdoc
- flexmock-1.0.4.rdoc
- flexmock-1.1.0.rdoc
- flexmock-1.2.0.rdoc
- flexmock-1.3.0.rdoc
- flexmock-1.3.1.rdoc

### Class/Module Index

Quicksearch

- FlexMock
- FlexMock::AnyMatcher
- FlexMock::ArgumentMatching
- FlexMock::ArgumentTypes
- FlexMock::AtLeastCountValidator
- FlexMock::AtMostCountValidator
- FlexMock::CallValidator
- FlexMock::CompositeExpectation
- FlexMock::CountValidator
- FlexMock::DefaultFrameworkAdapter
- FlexMock::DefaultFrameworkAdapter::AssertionFailedError
- FlexMock::DuckMatcher
- FlexMock::EqualMatcher
- FlexMock::ExactCountValidator
- FlexMock::Expectation
- FlexMock::ExpectationBuilder
- FlexMock::ExpectationDirector
- FlexMock::ExpectationRecorder
- FlexMock::ExplicitNeeded
- FlexMock::ExtensionRegistry
- FlexMock::Extensions
- FlexMock::Extensions::ActiveRecordModel
- FlexMock::GenericTestCase
- FlexMock::HashMatcher
- FlexMock::MockBuilder
- FlexMock::MockContainer
- FlexMock::MockError
- FlexMock::OptionalProcMatcher
- FlexMock::Ordering
- FlexMock::PartialMockProxy
- FlexMock::ProcMatcher
- FlexMock::RSpecFrameworkAdapter
- FlexMock::RSpecFrameworkAdapter::AssertionFailedError
- FlexMock::RSpecMatchers
- FlexMock::RSpecMatchers::HaveReceived
- FlexMock::Recorder
- FlexMock::SpyDescribers
- FlexMock::TestCase
- FlexMock::TestUnitAssertions
- FlexMock::TestUnitFrameworkAdapter
- FlexMock::Undefined
- FlexMock::UsageError
- FlexMock::UseContainer
- FlexMock::Version
- MiniTest
- MiniTest::Unit
- MiniTest::Unit::TestCase
- Test
- Test::Unit
- Test::Unit::TestCase
- Class
- Module
- Object
- Symbol

No matching classes.

# FlexMock::CompositeExpectation

A composite expectation allows several expectations to be grouped into a single composite and then apply the same constraints to all expectations in the group.

### Public Class Methods

new() click to toggle source

Initialize the composite expectation.

    # File lib/flexmock/composite_expectation.rb, line 9
    def initialize
      @expectations = []
    end

### Public Instance Methods

add(expectation) click to toggle source

Add an expectation to the composite.

    # File lib/flexmock/composite_expectation.rb, line 14
    def add(expectation)
      @expectations << expectation
    end

method_missing(sym, *args, &block) click to toggle source

Apply the constraint method to all expectations in the composite.

    # File lib/flexmock/composite_expectation.rb, line 19
    def method_missing(sym, *args, &block)
      @expectations.each do |expectation|
        expectation.send(sym, *args, &block)
      end
      self
    end

mock() click to toggle source

Return the associated mock object.

    # File lib/flexmock/composite_expectation.rb, line 35
    def mock
      @expectations.first.mock
    end

order_number() click to toggle source

Return the order number of the first expectation in the list.

    # File lib/flexmock/composite_expectation.rb, line 30
    def order_number
      @expectations.first.order_number
    end

should_receive(*args, &block) click to toggle source

Start a new method expectation. The following constraints will be applied to the new expectation.

    # File lib/flexmock/composite_expectation.rb, line 41
    def should_receive(*args, &block)
      @expectations.first.mock.
        flexmock_define_expectation(caller.first, *args, &block)
    end

to_s() click to toggle source

Return a string representations

    # File lib/flexmock/composite_expectation.rb, line 47
    def to_s
      if @expectations.size > 1
        "[" + @expectations.collect { |e| e.to_s }.join(', ') + "]"
      else
        @expectations.first.to_s
      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.