Class: ObjectProtocol::SatisfiableUnorderedMessageSequenceExpectation
- Inherits:
-
Object
- Object
- ObjectProtocol::SatisfiableUnorderedMessageSequenceExpectation
- Extended by:
- Forwardable
- Defined in:
- lib/object_protocol/satisfiable_unordered_message_sequence_expectation.rb
Instance Method Summary collapse
- #attempt_to_apply_sent_message(sent_message) ⇒ Object
-
#initialize(protocol:, sequence_expectation:) ⇒ SatisfiableUnorderedMessageSequenceExpectation
constructor
A new instance of SatisfiableUnorderedMessageSequenceExpectation.
- #satisfied? ⇒ Boolean
Constructor Details
#initialize(protocol:, sequence_expectation:) ⇒ SatisfiableUnorderedMessageSequenceExpectation
Returns a new instance of SatisfiableUnorderedMessageSequenceExpectation.
7 8 9 10 |
# File 'lib/object_protocol/satisfiable_unordered_message_sequence_expectation.rb', line 7 def initialize(protocol:, sequence_expectation:) @protocol = protocol @sequence_expectation = sequence_expectation end |
Instance Method Details
#attempt_to_apply_sent_message(sent_message) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/object_protocol/satisfiable_unordered_message_sequence_expectation.rb', line 12 def () return if satisfied? satisfiable_expectations.each do |satisfiable_expectation| if satisfiable_expectation.unsatisfied? satisfiable_expectation.() break if satisfiable_expectation.satisfied? end end end |
#satisfied? ⇒ Boolean
24 25 26 |
# File 'lib/object_protocol/satisfiable_unordered_message_sequence_expectation.rb', line 24 def satisfied? satisfiable_expectations.all?(&:satisfied?) end |