A behavior-driven development framework for Swift. Inspired by RSpec, Specta, and Ginkgo.
import XCTest
class PersonSpec: QuickSpec {
override class var isConcreteSpec: Bool { get { return true } }
override class func exampleGroups() {
describe("Person") {
var person: Person?
beforeEach() { person = Person() }
it("is happy") {
XCTAssert(person!.isHappy,
"expected person to be happy by default")
}
describe("greeting") {
context("when the person is unhappy") {
beforeEach() { person!.isHappy = false }
it("is lukewarm") {
XCTAssertEqualObjects(person!.greeting, "Oh, hi.",
"expected a lukewarm greeting")
}
}
context("when the person is happy") {
beforeEach() { person!.isHappy = true }
it("is enthusiastic") {
XCTAssertEqualObjects(person!.greeting, "Hello!",
"expected an enthusiastic greeting")
}
}
}
}
}
}
This module is not yet fit for general consumption. Still, if you want to test it out:
- Clone the repository
- Add the files in
QuickTests/Quick
to your test target - Set the
Objective-C Bridging Header
of your test target toQuickTests/Quick/QuickTests-Bridging-Header.h
- Start writing specs!
MIT license. See the LICENSE
file for details.