Method: Mocha::API#sequence

Defined in:
lib/mocha/api.rb

#sequence(name) ⇒ Object

:call-seq: sequence(name) -> sequence

Returns a new sequence that is used to constrain the order in which expectations can occur.

Specify that an expected invocation must occur in within a named sequence by using Expectation#in_sequence.

See also Expectation#in_sequence.

breakfast = sequence('breakfast')

egg = mock('egg')
egg.expects(:crack).in_sequence(breakfast)
egg.expects(:fry).in_sequence(breakfast)
egg.expects(:eat).in_sequence(breakfast)


122
123
124
# File 'lib/mocha/api.rb', line 122

def sequence(name)
  Sequence.new(name)
end