v7.0.0 Beta 1
Pre-releaseQuick 7 changes how Async tests are run. Instead of forcing all tests to run in an async context, Quick 7 provides a separate Spec class for Async Tests. Create an AsyncSpec
subclass, and all tests inside of that subclass will run in an async context. Tests inside of QuickSpec
subclasses will have a similar behavior to what was in Quick 5.
Additionally, Quick 7 changes how the DSL is defined slightly. In Quick 6 and before, the DSL was defined as a series of global functions, available to be called anywhere. In Quick 7, these functions were moved to be static methods on the new SyncDSLUser
(which QuickSpec
, Behavior
, and QuickConfiguration
conform to) and AsyncDSLUser
(which AsyncSpec
and AsyncBehavior
conform to) protocols. This allows us to make sure that you are using the correct DSL for the context, and was necessary for this approach.
For example:
class SynchronousSpec: QuickSpec {
override class func spec() {
it("runs synchronously, as you'd expect") {
var ocean: [String] = []
DispatchQueue.main.async {
ocean.append("dolphins")
ocean.append("whales")
}
expect(ocean).toEventually(contain("dolphins", "whales"))
}
}
}
class AsynchronousSpec: AsyncSpec {
override class func spec() {
it("runs the test in an async context") {
var ocean: [String] = []
DispatchQueue.main.async {
ocean.append("dolphins")
ocean.append("whales")
}
await expect(ocean).toEventually(contain("dolphins", "whales"))
}
}
}
We encourage you to check this out, and to share feedback by filing an issue or discussing this in the discussions.
Full Changelog: v6.1.0...v7.0.0-beta.1