Skip to content

Instantly share code, notes, and snippets.

@andru255
Created July 25, 2018 16:28
Show Gist options
  • Save andru255/96e1cc466719165e4296b9bee417885b to your computer and use it in GitHub Desktop.
Save andru255/96e1cc466719165e4296b9bee417885b to your computer and use it in GitHub Desktop.
class BooksTests: QuickSpec {
override func spec() {
describe("Book") {
let adapter = NetworkAdapter()
let mockFinder = MockBookFinder(adapter: adapter)
it("MockBookFinder.searchBy success") {
var wasSuccess = false
mockFinder.searchBy(author: "jhon doe", success: { data in
wasSuccess = true
})
expect(wasSuccess).toEventually(equal(true))
}
it("MockBookFinder.searchBy error") {
var wasFail = false
mockFinder.searchByFail(author: "jhon doe", fail: { _ in
wasFail = true
})
expect(wasFail).toEventually(equal(true))
}
it("MockBookFinder.getTotalSearch") {
expect(mockFinder.getTotalSearch()).to(equal(2))
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment