class RSpec::Mocks::Matchers::ReceiveMessages

@private

Public Class Methods

# File rspec-mocks/lib/rspec/mocks/matchers/receive_messages.rb, line 8
def initialize(message_return_value_hash)
  @message_return_value_hash = message_return_value_hash
  @backtrace_line = CallerFilter.first_non_rspec_line
end

Public Instance Methods

# File rspec-mocks/lib/rspec/mocks/matchers/receive_messages.rb, line 17
def description
  "receive messages: #{@message_return_value_hash.inspect}"
end
# File rspec-mocks/lib/rspec/mocks/matchers/receive_messages.rb, line 13
def matcher_name
  "receive_messages"
end
# File rspec-mocks/lib/rspec/mocks/matchers/receive_messages.rb, line 36
def setup_allowance(subject)
  warn_about_block if block_given?
  each_message_on(proxy_on(subject)) do |host, message, return_value|
    host.add_simple_stub(message, return_value)
  end
end
# File rspec-mocks/lib/rspec/mocks/matchers/receive_messages.rb, line 50
def setup_any_instance_allowance(subject)
  warn_about_block if block_given?
  any_instance_of(subject).stub(@message_return_value_hash)
end
# File rspec-mocks/lib/rspec/mocks/matchers/receive_messages.rb, line 43
def setup_any_instance_expectation(subject)
  warn_about_block if block_given?
  each_message_on(any_instance_of(subject)) do |host, message, return_value|
    host.should_receive(message).and_return(return_value)
  end
end
# File rspec-mocks/lib/rspec/mocks/matchers/receive_messages.rb, line 21
def setup_expectation(subject)
  warn_about_block if block_given?
  each_message_on(proxy_on(subject)) do |host, message, return_value|
    host.add_simple_expectation(message, return_value, @backtrace_line)
  end
end
Also aliased as: matches?
# File rspec-mocks/lib/rspec/mocks/matchers/receive_messages.rb, line 29
def setup_negative_expectation(_subject)
  raise NegationUnsupportedError,
        "`expect(...).to_not receive_messages` is not supported since it " \
        "doesn't really make sense. What would it even mean?"
end
Also aliased as: does_not_match?
# File rspec-mocks/lib/rspec/mocks/matchers/receive_messages.rb, line 55
def warn_about_block
  raise "Implementation blocks aren't supported with `receive_messages`"
end