Last active
August 19, 2017 17:46
-
-
Save tovkal/96f4a3ad98b32d2ec2e3a19166e1b2f3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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