Mockingbird Documentation 0.14.0

Structure Ordered​Verification​Options

public struct OrderedVerificationOptions: OptionSet

Additional options to increase the strictness of inOrder verification blocks.

%3 OrderedVerificationOptions OrderedVerificationOptions OptionSet OptionSet OrderedVerificationOptions->OptionSet

Conforms To

OptionSet

Initializers

init(raw​Value:​)

public init(rawValue: Int)

Properties

raw​Value

let rawValue: Int

no​Invocations​Before

let noInvocationsBefore

Check that there are no recorded invocations before those explicitly verified in the block.

Use this option to disallow invocations prior to those satisfying the first verification.

bird.eat()
bird.fly()
bird.chirp()

// Passes _without_ the option
inOrder {
  verify(bird.fly()).wasCalled()
  verify(bird.chirp()).wasCalled()
}

// Fails with the option
inOrder(with: .noInvocationsBefore) {
  verify(bird.fly()).wasCalled()
  verify(bird.chirp()).wasCalled()
}

no​Invocations​After

let noInvocationsAfter

Check that there are no recorded invocations after those explicitly verified in the block.

Use this option to disallow subsequent invocations to those satisfying the last verification.

bird.fly()
bird.chirp()
bird.eat()

// Passes _without_ the option
inOrder {
  verify(bird.fly()).wasCalled()
  verify(bird.chirp()).wasCalled()
}

// Fails with the option
inOrder(with: .noInvocationsAfter) {
  verify(bird.fly()).wasCalled()
  verify(bird.chirp()).wasCalled()
}

only​Consecutive​Invocations

let onlyConsecutiveInvocations

Check that there are no recorded invocations between those explicitly verified in the block.

Use this option to disallow non-consecutive invocations to each verification.

bird.fly()
bird.eat()
bird.chirp()

// Passes _without_ the option
inOrder {
  verify(bird.fly()).wasCalled()
  verify(bird.chirp()).wasCalled()
}

// Fails with the option
inOrder(with: .noInvocationsAfter) {
  verify(bird.fly()).wasCalled()
  verify(bird.chirp()).wasCalled()
}