Used to constrain the order in which expectations can occur.
@see Mocha::API#sequence @see Mocha::Expectation#in_sequence
@private
# File lib/mocha/sequence.rb, line 27 def initialize(name) @name = name @expectations = [] end
@private
# File lib/mocha/sequence.rb, line 33 def constrain_as_next_in_sequence(expectation) index = @expectations.length @expectations << expectation expectation.add_ordering_constraint(InSequenceOrderingConstraint.new(self, index)) end
@private
# File lib/mocha/sequence.rb, line 45 def mocha_inspect "#{@name.mocha_inspect}" end
@private
# File lib/mocha/sequence.rb, line 40 def satisfied_to_index?(index) @expectations[0...index].all? { |expectation| expectation.satisfied? } end