Mockingbird Documentation 0.17.0

Structure Ordered​Verification​Options

public struct OrderedVerificationOptions: OptionSet  

Additional options to increase the strictness of inOrder verification blocks.

OrderedVerificationOptions OrderedVerificationOptions OptionSet OptionSet OrderedVerificationOptions->OptionSet

Conforms To

OptionSet

Initializers

init(raw​Value:​)

public init(rawValue: Int)  

Properties

raw​Value

public let rawValue: Int

no​Invocations​Before

public static 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

public static 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

public static 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()
}