 
     func testThatItCallsDie() {
         // when
-        dispatch(die)
-        spinMainQueue(1)
+        dispatchAndWaitForDie(timeout: 2, block: die)
 
         // then
         XCTAssertEqual(callCount, 1)

    var exitStatus: Int32?
    var printHistory: [[Any]] = []
    let spinMainQueue = NSThread.sleepForTimeInterval

    // MARK: - Mocking

    @noreturn private func mockExit(status: Int32) {
        exitStatus = status
        callCount++
        repeat { NSRunLoop.currentRunLoop().run() } while (true)
    }


        var solution: Int?

        // when
        self.dispatch {
            solution = dieOnThrow {
                return 42
            }
        }
        spinMainQueue(2)

        // then
        XCTAssertEqual(callCount, 0)
