class RSpec::Mocks::Matchers::Receive

@private

Public Class Methods

new(message, block) click to toggle source
# File lib/rspec/mocks/matchers/receive.rb, line 10
def initialize(message, block)
  @message                 = message
  @block                   = block
  @recorded_customizations = []
end

Public Instance Methods

description() click to toggle source
# File lib/rspec/mocks/matchers/receive.rb, line 20
def description
  describable.description_for("receive")
end
does_not_match?(subject, &block) click to toggle source
matches?(subject, &block) click to toggle source
Alias for: setup_expectation
name() click to toggle source
# File lib/rspec/mocks/matchers/receive.rb, line 16
def name
  "receive"
end
setup_allowance(subject, &block) click to toggle source
# File lib/rspec/mocks/matchers/receive.rb, line 41
def setup_allowance(subject, &block)
  warn_if_any_instance("allow", subject)
  setup_mock_proxy_method_substitute(subject, :add_stub, block)
end
setup_any_instance_allowance(subject, &block) click to toggle source
# File lib/rspec/mocks/matchers/receive.rb, line 54
def setup_any_instance_allowance(subject, &block)
  setup_any_instance_method_substitute(subject, :stub, block)
end
setup_any_instance_expectation(subject, &block) click to toggle source
# File lib/rspec/mocks/matchers/receive.rb, line 46
def setup_any_instance_expectation(subject, &block)
  setup_any_instance_method_substitute(subject, :should_receive, block)
end
setup_any_instance_negative_expectation(subject, &block) click to toggle source
# File lib/rspec/mocks/matchers/receive.rb, line 50
def setup_any_instance_negative_expectation(subject, &block)
  setup_any_instance_method_substitute(subject, :should_not_receive, block)
end
setup_expectation(subject, &block) click to toggle source
# File lib/rspec/mocks/matchers/receive.rb, line 24
def setup_expectation(subject, &block)
  warn_if_any_instance("expect", subject)
  @describable = setup_mock_proxy_method_substitute(subject, :add_message_expectation, block)
end
Also aliased as: matches?
setup_negative_expectation(subject, &block) click to toggle source
# File lib/rspec/mocks/matchers/receive.rb, line 30
def setup_negative_expectation(subject, &block)
  # ensure `never` goes first for cases like `never.and_return(5)`,
  # where `and_return` is meant to raise an error
  @recorded_customizations.unshift ExpectationCustomization.new(:never, [], nil)

  warn_if_any_instance("expect", subject)

  setup_expectation(subject, &block)
end
Also aliased as: does_not_match?