Skip to content

Instantly share code, notes, and snippets.

@tovkal
Last active August 19, 2017 17:46
Show Gist options
  • Save tovkal/96f4a3ad98b32d2ec2e3a19166e1b2f3 to your computer and use it in GitHub Desktop.
Save tovkal/96f4a3ad98b32d2ec2e3a19166e1b2f3 to your computer and use it in GitHub Desktop.
private func beContent(test: @escaping (Response) -> Void = { _ in }) -> Predicate<State> {
return Predicate.define("be <content>") { expression, message in
if let actual = try expression.evaluate(),
case let .content(response) = actual {
test(response)
return PredicateResult(status: .matches, message: message)
}
return PredicateResult(status: .fail, message: message)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment