Skip to content

Instantly share code, notes, and snippets.

@LucianoPAlmeida
Last active July 27, 2019 16:26
Show Gist options
  • Save LucianoPAlmeida/b28753bd86089676466b220bf0b11acc to your computer and use it in GitHub Desktop.
Save LucianoPAlmeida/b28753bd86089676466b220bf0b11acc to your computer and use it in GitHub Desktop.
Quick and Nimble Testing
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: {
self.service.changeTypes(compound: .hard, into: self.car)
expect(self.car.tireLaps).to(equal(0))
expect(self.car.tyreCompound).to(equal(.hard))
})
afterEach {
self.car = nil
}
})
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment