class RSpec::Mocks::Matchers::ReceiveMessageChain

@private

Public Class Methods

new(chain, &block) click to toggle source
# File lib/rspec/mocks/matchers/receive_message_chain.rb, line 8
def initialize(chain, &block)
  @chain = chain
  @block = block
  @recorded_customizations  = []
end

Public Instance Methods

does_not_match?(*args)
matches?(subject, &block)
Alias for: setup_expectation
name() click to toggle source
# File lib/rspec/mocks/matchers/receive_message_chain.rb, line 21
def name
  "receive_message_chain"
end
setup_allowance(subject, &block) click to toggle source
# File lib/rspec/mocks/matchers/receive_message_chain.rb, line 25
def setup_allowance(subject, &block)
  chain = StubChain.stub_chain_on(subject, *@chain, &(@block || block))
  replay_customizations(chain)
end
setup_any_instance_allowance(subject, &block) click to toggle source
# File lib/rspec/mocks/matchers/receive_message_chain.rb, line 30
def setup_any_instance_allowance(subject, &block)
  proxy = ::RSpec::Mocks.space.any_instance_proxy_for(subject)
  chain = proxy.stub_chain(*@chain, &(@block || block))
  replay_customizations(chain)
end
setup_any_instance_expectation(subject, &block) click to toggle source
# File lib/rspec/mocks/matchers/receive_message_chain.rb, line 36
def setup_any_instance_expectation(subject, &block)
  proxy = ::RSpec::Mocks.space.any_instance_proxy_for(subject)
  chain = proxy.expect_chain(*@chain, &(@block || block))
  replay_customizations(chain)
end
setup_expectation(subject, &block) click to toggle source
# File lib/rspec/mocks/matchers/receive_message_chain.rb, line 42
def setup_expectation(subject, &block)
  chain = ExpectChain.expect_chain_on(subject, *@chain, &(@block || block))
  replay_customizations(chain)
end
Also aliased as: matches?
setup_negative_expectation(*args) click to toggle source
# File lib/rspec/mocks/matchers/receive_message_chain.rb, line 47
def setup_negative_expectation(*args)
  raise NegationUnsupportedError.new(
    "`expect(...).not_to receive_message_chain` is not supported " +
    "since it doesn't really make sense. What would it even mean?"
  )
end
Also aliased as: does_not_match?

Private Instance Methods

replay_customizations(chain) click to toggle source
# File lib/rspec/mocks/matchers/receive_message_chain.rb, line 59
def replay_customizations(chain)
  @recorded_customizations.each do |customization|
    customization.playback_onto(chain)
  end
end