Skip to content

Instantly share code, notes, and snippets.

@LucianoPAlmeida
Last active July 27, 2019 16:26
Show Gist options
  • Save LucianoPAlmeida/cb699f02fe095906127ecf4b17ed3d07 to your computer and use it in GitHub Desktop.
Save LucianoPAlmeida/cb699f02fe095906127ecf4b17ed3d07 to your computer and use it in GitHub Desktop.
Quick and Nimble
import Quick
import Nimble
@testable import FormulaOne
class TestPitStop: QuickSpec {
var car: Car?
var service: CarService = CarService()
override func spec() {
describe("A race pit stop") {
context("Given the vehicle stops in the pit after 15 laps", closure: {
beforeEach {
self.car = Car(tireLaps: 15, tyreCompound: .soft)
}
it("It should exit with new types", closure: {
var pitTime: TimeInterval = 0
self.service.changeTypes(compound: .hard, into: self.car) { time in
pitTime = time
}
// Wait until meets the condition or times out.
expect(pitTime).toEventuallyNot(equal(0), timeout: 0.5)
})
afterEach {
self.car = nil
}
})
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment