Class: RSpec::Mocks::Matchers::ReceiveMessages Private
Do not use. This class is for internal use only.
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Instance Chain:
self,
Matcher
|
|
Inherits: | Object |
Defined in: | rspec-mocks/lib/rspec/mocks/matchers/receive_messages.rb |
Class Method Summary
- .new(message_return_value_hash) ⇒ ReceiveMessages constructor Internal use only
Instance Method Summary
- #description Internal use only
-
#does_not_match?(_subject)
Alias for #setup_negative_expectation.
- #matcher_name Internal use only
-
#matches?(subject)
Alias for #setup_expectation.
- #setup_allowance(subject) Internal use only
- #setup_any_instance_allowance(subject) Internal use only
- #setup_any_instance_expectation(subject) Internal use only
- #setup_expectation(subject) (also: #matches?) Internal use only
- #setup_negative_expectation(_subject) (also: #does_not_match?) Internal use only
- #warn_about_block Internal use only
- #any_instance_of(subject) private Internal use only
- #each_message_on(host) private Internal use only
- #proxy_on(subject) private Internal use only
Instance Method Details
#any_instance_of(subject) (private)
[ GitHub ]#description
[ GitHub ]# File 'rspec-mocks/lib/rspec/mocks/matchers/receive_messages.rb', line 17
def description "receive messages: #{@message_return_value_hash.inspect}" end
#does_not_match?(_subject)
Alias for #setup_negative_expectation.
# File 'rspec-mocks/lib/rspec/mocks/matchers/receive_messages.rb', line 34
alias does_not_match? setup_negative_expectation
#each_message_on(host) (private)
[ GitHub ]# File 'rspec-mocks/lib/rspec/mocks/matchers/receive_messages.rb', line 69
def (host) @message_return_value_hash.each do |, value| yield host, , value end end
#matcher_name
[ GitHub ]# File 'rspec-mocks/lib/rspec/mocks/matchers/receive_messages.rb', line 13
def matcher_name "receive_messages" end
#matches?(subject)
Alias for #setup_expectation.
# File 'rspec-mocks/lib/rspec/mocks/matchers/receive_messages.rb', line 27
alias matches? setup_expectation
#proxy_on(subject) (private)
[ GitHub ]#setup_allowance(subject)
[ GitHub ]# File 'rspec-mocks/lib/rspec/mocks/matchers/receive_messages.rb', line 36
def setup_allowance(subject) warn_about_block if block_given? (proxy_on(subject)) do |host, , return_value| host.add_simple_stub(, return_value) end end
#setup_any_instance_allowance(subject)
[ GitHub ]# 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
#setup_any_instance_expectation(subject)
[ GitHub ]# File 'rspec-mocks/lib/rspec/mocks/matchers/receive_messages.rb', line 43
def setup_any_instance_expectation(subject) warn_about_block if block_given? (any_instance_of(subject)) do |host, , return_value| host.should_receive( ).and_return(return_value) end end
#setup_expectation(subject) Also known as: #matches?
[ GitHub ]# File 'rspec-mocks/lib/rspec/mocks/matchers/receive_messages.rb', line 21
def setup_expectation(subject) warn_about_block if block_given? (proxy_on(subject)) do |host, , return_value| host.add_simple_expectation(, return_value, @backtrace_line) end end
#setup_negative_expectation(_subject) Also known as: #does_not_match?
# 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
#warn_about_block
[ GitHub ]# 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