Skip to content

Instantly share code, notes, and snippets.

@victorpanitz
Created October 27, 2019 05:30
Show Gist options
  • Save victorpanitz/ebe827284debf2a0c3ad53a02d26e487 to your computer and use it in GitHub Desktop.
Save victorpanitz/ebe827284debf2a0c3ad53a02d26e487 to your computer and use it in GitHub Desktop.
import os.log
func given<A>(_ description: String, block: () throws -> A) rethrows -> A {
os_log("1º Given %{public}@", description)
return try XCTContext.runActivity(named: "Given " + description, block: { _ in try block() })
}
func when<A>(_ description: String, block: () throws -> A) rethrows -> A {
os_log("2º When %{public}@", description)
return try XCTContext.runActivity(named: "When " + description, block: { _ in try block() })
}
func then<A>(_ description: String, block: () throws -> A) rethrows -> A {
os_log("3º Then %{public}@", description)
return try XCTContext.runActivity(named: "Then " + description, block: { _ in try block() })
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment