Skip to content

Instantly share code, notes, and snippets.

@polac24
Created March 31, 2019 18:00
Show Gist options
  • Save polac24/8b832f8bf403035e7f95bb5ccafeeaf9 to your computer and use it in GitHub Desktop.
Save polac24/8b832f8bf403035e7f95bb5ccafeeaf9 to your computer and use it in GitHub Desktop.
class DatabaseStub: Database {
lazy var addUserAction = niceStub(of: addUser, thatReturns: true)
func addUser(name: String) -> Bool {
return addUserAction(name)
}
}
func testAddingUser_savesToDatabase () {
// Act
database.addUser(name: "user1") // ✅, doesn't crash
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment