Class: RSpec::Mocks::AnyInstance::MessageChains

### Home Classes Methods

### In Files

- lib/rspec/mocks/any_instance/message_chains.rb

### Parent

Object

### Methods

- ::new
- #[]
- #add
- #all_expectations_fulfilled?
- #each_unfulfilled_expectation_matching
- #has_expectation?
- #playback!
- #received_expected_message!
- #remove_stub_chains_for!
- #unfulfilled_expectations

### Class/Module Index

Quicksearch

- RSpec
- RSpec::Mocks
- RSpec::Mocks::AllowanceTarget
- RSpec::Mocks::AndReturnImplementation
- RSpec::Mocks::AndWrapOriginalImplementation
- RSpec::Mocks::AndYieldImplementation
- RSpec::Mocks::AnyInstance
- RSpec::Mocks::AnyInstance::Chain
- RSpec::Mocks::AnyInstance::Chain::Customizations
- RSpec::Mocks::AnyInstance::ExpectChainChain
- RSpec::Mocks::AnyInstance::ExpectationChain
- RSpec::Mocks::AnyInstance::FluentInterfaceProxy
- RSpec::Mocks::AnyInstance::MessageChains
- RSpec::Mocks::AnyInstance::PositiveExpectationChain
- RSpec::Mocks::AnyInstance::Proxy
- RSpec::Mocks::AnyInstance::Recorder
- RSpec::Mocks::AnyInstance::StubChain
- RSpec::Mocks::AnyInstance::StubChainChain
- RSpec::Mocks::AnyInstanceAllowanceTarget
- RSpec::Mocks::AnyInstanceExpectationTarget
- RSpec::Mocks::ArgumentListMatcher
- RSpec::Mocks::ArgumentMatchers
- RSpec::Mocks::ArgumentMatchers::AnyArgMatcher
- RSpec::Mocks::ArgumentMatchers::AnyArgsMatcher
- RSpec::Mocks::ArgumentMatchers::ArrayIncludingMatcher
- RSpec::Mocks::ArgumentMatchers::BaseHashMatcher
- RSpec::Mocks::ArgumentMatchers::BooleanMatcher
- RSpec::Mocks::ArgumentMatchers::DuckTypeMatcher
- RSpec::Mocks::ArgumentMatchers::HashExcludingMatcher
- RSpec::Mocks::ArgumentMatchers::HashIncludingMatcher
- RSpec::Mocks::ArgumentMatchers::InstanceOf
- RSpec::Mocks::ArgumentMatchers::KindOf
- RSpec::Mocks::ArgumentMatchers::NoArgsMatcher
- RSpec::Mocks::ArgumentMatchers::SingletonMatcher
- RSpec::Mocks::ClassVerifyingDouble
- RSpec::Mocks::Configuration
- RSpec::Mocks::Constant
- RSpec::Mocks::ConstantMutator
- RSpec::Mocks::ConstantMutator::BaseMutator
- RSpec::Mocks::ConstantMutator::ConstantHider
- RSpec::Mocks::ConstantMutator::DefinedConstantReplacer
- RSpec::Mocks::ConstantMutator::UndefinedConstantSetter
- RSpec::Mocks::DirectObjectReference
- RSpec::Mocks::Double
- RSpec::Mocks::ErrorGenerator
- RSpec::Mocks::ExampleMethods
- RSpec::Mocks::ExampleMethods::ExpectHost
- RSpec::Mocks::ExpectChain
- RSpec::Mocks::ExpectationTarget
- RSpec::Mocks::Implementation
- RSpec::Mocks::InsertOntoBacktrace
- RSpec::Mocks::InstanceMethodReference
- RSpec::Mocks::InstanceMethodStasher
- RSpec::Mocks::InstanceVerifyingDouble
- RSpec::Mocks::MarshalExtension
- RSpec::Mocks::Matchers
- RSpec::Mocks::Matchers::ExpectationCustomization
- RSpec::Mocks::Matchers::HaveReceived
- RSpec::Mocks::Matchers::Receive
- RSpec::Mocks::Matchers::Receive::DefaultDescribable
- RSpec::Mocks::Matchers::ReceiveMessageChain
- RSpec::Mocks::Matchers::ReceiveMessages
- RSpec::Mocks::MessageChain
- RSpec::Mocks::MessageExpectation
- RSpec::Mocks::MessageExpectation::ImplementationDetails
- RSpec::Mocks::MethodDouble
- RSpec::Mocks::MethodReference
- RSpec::Mocks::NamedObjectReference
- RSpec::Mocks::NestedSpace
- RSpec::Mocks::ObjectMethodReference
- RSpec::Mocks::ObjectReference
- RSpec::Mocks::ObjectVerifyingDouble
- RSpec::Mocks::ObjectVerifyingDoubleMethods
- RSpec::Mocks::OrderGroup
- RSpec::Mocks::PartialClassDoubleProxy
- RSpec::Mocks::PartialClassDoubleProxyMethods
- RSpec::Mocks::PartialDoubleProxy
- RSpec::Mocks::Proxy
- RSpec::Mocks::ProxyForNil
- RSpec::Mocks::RootSpace
- RSpec::Mocks::SimpleMessageExpectation
- RSpec::Mocks::Space
- RSpec::Mocks::Space::FakeMutex
- RSpec::Mocks::StubChain
- RSpec::Mocks::Syntax
- RSpec::Mocks::TargetBase
- RSpec::Mocks::TestDouble
- RSpec::Mocks::TestDoubleProxy
- RSpec::Mocks::VerifyingDouble
- RSpec::Mocks::VerifyingExistingMethodDouble
- RSpec::Mocks::VerifyingMessageExpectation
- RSpec::Mocks::VerifyingMethodDouble
- RSpec::Mocks::VerifyingPartialClassDoubleProxy
- RSpec::Mocks::VerifyingPartialDoubleProxy
- RSpec::Mocks::VerifyingProxy
- RSpec::Mocks::VerifyingProxyMethods
- RSpec::Mocks::Version
- BasicObject
- Class

No matching classes.

# RSpec::Mocks::AnyInstance::MessageChains

@private

### Public Class Methods

new() click to toggle source

    # File lib/rspec/mocks/any_instance/message_chains.rb, line 6
    def initialize
      @chains_by_method_name = Hash.new { |h, k| h[k] = [] }
    end

### Public Instance Methods

[](method_name) click to toggle source

@private

    # File lib/rspec/mocks/any_instance/message_chains.rb, line 11
    def [](method_name)
      @chains_by_method_name[method_name]
    end

add(method_name, chain) click to toggle source

@private

    # File lib/rspec/mocks/any_instance/message_chains.rb, line 16
    def add(method_name, chain)
      @chains_by_method_name[method_name] << chain
      chain
    end

all_expectations_fulfilled?() click to toggle source

@private

    # File lib/rspec/mocks/any_instance/message_chains.rb, line 43
    def all_expectations_fulfilled?
      @chains_by_method_name.all? do |_method_name, chains|
        chains.all? { |chain| chain.expectation_fulfilled? }
      end
    end

each_unfulfilled_expectation_matching(method_name, *args) click to toggle source

@private

    # File lib/rspec/mocks/any_instance/message_chains.rb, line 36
    def each_unfulfilled_expectation_matching(method_name, *args)
      @chains_by_method_name[method_name].each do |chain|
        yield chain if !chain.expectation_fulfilled? && chain.matches_args?(*args)
      end
    end

has_expectation?(method_name) click to toggle source

@private

    # File lib/rspec/mocks/any_instance/message_chains.rb, line 29
    def has_expectation?(method_name)
      @chains_by_method_name[method_name].find do |chain|
        ExpectationChain === chain
      end
    end

playback!(instance, method_name) click to toggle source

@private

    # File lib/rspec/mocks/any_instance/message_chains.rb, line 64
    def playback!(instance, method_name)
      raise_if_second_instance_to_receive_message(instance)
      @chains_by_method_name[method_name].each do |chain|
        chain.playback!(instance)
      end
    end

received_expected_message!(method_name) click to toggle source

@private

    # File lib/rspec/mocks/any_instance/message_chains.rb, line 57
    def received_expected_message!(method_name)
      @chains_by_method_name[method_name].each do |chain|
        chain.expectation_fulfilled!
      end
    end

remove_stub_chains_for!(method_name) click to toggle source

@private

    # File lib/rspec/mocks/any_instance/message_chains.rb, line 22
    def remove_stub_chains_for!(method_name)
      @chains_by_method_name[method_name].reject! do |chain|
        StubChain === chain
      end
    end

unfulfilled_expectations() click to toggle source

@private

    # File lib/rspec/mocks/any_instance/message_chains.rb, line 50
    def unfulfilled_expectations
      @chains_by_method_name.map do |method_name, chains|
        method_name.to_s if ExpectationChain === chains.last unless chains.last.expectation_fulfilled?
      end.compact
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.