Class: RSpec::Mocks::Matchers::ReceiveMessageChain

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec/mocks/matchers/receive_message_chain.rb

Instance Method Summary (collapse)

Constructor Details

- (ReceiveMessageChain) initialize(chain, &block)



8
9
10
11
12
# File 'lib/rspec/mocks/matchers/receive_message_chain.rb', line 8

def initialize(chain, &block)
  @chain = chain
  @block = block
  @recorded_customizations  = []
end

Instance Method Details

- (Object) name



21
22
23
# File 'lib/rspec/mocks/matchers/receive_message_chain.rb', line 21

def name
  "receive_message_chain"
end

- (Object) setup_allowance(subject, &block)



25
26
27
28
# 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

- (Object) setup_any_instance_allowance(subject, &block)



30
31
32
33
34
# 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

- (Object) setup_any_instance_expectation(subject, &block)



36
37
38
39
40
# 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

- (Object) setup_expectation(subject, &block) Also known as: matches?



42
43
44
45
# 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

- (Object) setup_negative_expectation(*args) Also known as: does_not_match?



47
48
49
50
51
52
# 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