Parent

Class/Module Index [+]

Quicksearch

RSpec::Mocks::MessageChain

@private

Attributes

block[R]
chain[R]
object[R]

Public Class Methods

new(object, *chain, &blk) click to toggle source
# File lib/rspec/mocks/message_chain.rb, line 7
def initialize(object, *chain, &blk)
  @object = object
  @chain, @block = format_chain(*chain, &blk)
end

Public Instance Methods

setup_chain() click to toggle source

@api private

# File lib/rspec/mocks/message_chain.rb, line 13
def setup_chain
  if chain.length > 1
    if matching_stub = find_matching_stub
      chain.shift
      chain_on(matching_stub.invoke(nil), *chain, &@block)
    elsif matching_expectation = find_matching_expectation
      chain.shift
      chain_on(matching_expectation.invoke_without_incrementing_received_count(nil), *chain, &@block)
    else
      next_in_chain = Double.new
      expectation(object, chain.shift) { next_in_chain }
      chain_on(next_in_chain, *chain, &@block)
    end
  else
    expectation(object, chain.shift, &@block)
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.