Class: Crspec::Mock::ReceiveMessagesMatcher
- Inherits:
-
Object
- Object
- Crspec::Mock::ReceiveMessagesMatcher
- Defined in:
- lib/crspec/mock/double.rb
Overview
allow(target).to receive_messages(a: 1, b: 2)
Instance Method Summary collapse
-
#initialize(messages) ⇒ ReceiveMessagesMatcher
constructor
A new instance of ReceiveMessagesMatcher.
- #setup_allow(target) ⇒ Object
- #setup_expect(target) ⇒ Object
Constructor Details
#initialize(messages) ⇒ ReceiveMessagesMatcher
Returns a new instance of ReceiveMessagesMatcher.
328 329 330 |
# File 'lib/crspec/mock/double.rb', line 328 def initialize() @messages = end |
Instance Method Details
#setup_allow(target) ⇒ Object
332 333 334 335 336 |
# File 'lib/crspec/mock/double.rb', line 332 def setup_allow(target) @messages.map do |method_name, value| StubChain.new(target, method_name).and_return(value) end end |
#setup_expect(target) ⇒ Object
338 339 340 341 342 |
# File 'lib/crspec/mock/double.rb', line 338 def setup_expect(target) @messages.map do |method_name, value| ExpectationChain.new(target, method_name).and_return(value) end end |