Method: RSpec::Mocks::MessageExpectation#ordered

Defined in:
lib/rspec/mocks/message_expectation.rb

#ordered(&block) ⇒ MessageExpectation

Expect messages to be received in a specific order.

Examples:

expect(api).to receive(:prepare).ordered
expect(api).to receive(:run).ordered
expect(api).to receive(:finish).ordered

Returns:



333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
# File 'lib/rspec/mocks/message_expectation.rb', line 333

def ordered(&block)
  if type == :stub
    RSpec.warning(
      "`allow(...).to receive(..).ordered` is not supported and will " \
      "have no effect, use `and_return(*ordered_values)` instead."
    )
  end

  self.inner_implementation_action = block
  additional_expected_calls.times do
    @order_group.register(self)
  end
  @ordered = true
  self
end