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

Inherits:
Object
  • Object
show all
Includes:
Matcher
Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-mocks-3.12.2/lib/rspec/mocks/matchers/receive_message_chain.rb

Instance Method Summary collapse

Constructor Details

#initialize(chain, &block) ⇒ ReceiveMessageChain

Returns a new instance of ReceiveMessageChain.



10
11
12
13
14
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-mocks-3.12.2/lib/rspec/mocks/matchers/receive_message_chain.rb', line 10

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

Instance Method Details

#descriptionObject



27
28
29
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-mocks-3.12.2/lib/rspec/mocks/matchers/receive_message_chain.rb', line 27

def description
  "receive message chain #{formatted_chain}"
end

#matcher_nameObject



23
24
25
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-mocks-3.12.2/lib/rspec/mocks/matchers/receive_message_chain.rb', line 23

def matcher_name
  "receive_message_chain"
end

#setup_allowance(subject, &block) ⇒ Object



31
32
33
34
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-mocks-3.12.2/lib/rspec/mocks/matchers/receive_message_chain.rb', line 31

def setup_allowance(subject, &block)
  chain = StubChain.stub_chain_on(subject, *@chain, &(@block || block))
  replay_customizations(chain)
end

#setup_any_instance_allowance(subject, &block) ⇒ Object



36
37
38
39
40
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-mocks-3.12.2/lib/rspec/mocks/matchers/receive_message_chain.rb', line 36

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) ⇒ Object



42
43
44
45
46
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-mocks-3.12.2/lib/rspec/mocks/matchers/receive_message_chain.rb', line 42

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) ⇒ Object Also known as: matches?



48
49
50
51
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-mocks-3.12.2/lib/rspec/mocks/matchers/receive_message_chain.rb', line 48

def setup_expectation(subject, &block)
  chain = ExpectChain.expect_chain_on(subject, *@chain, &(@block || block))
  replay_customizations(chain)
end

#setup_negative_expectation(*_args) ⇒ Object Also known as: does_not_match?



53
54
55
56
57
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-mocks-3.12.2/lib/rspec/mocks/matchers/receive_message_chain.rb', line 53

def setup_negative_expectation(*_args)
  raise NegationUnsupportedError,
        "`expect(...).not_to receive_message_chain` is not supported " \
        "since it doesn't really make sense. What would it even mean?"
end