                 condition = conditionsCheck()
                 let currentTime = NSDate().timeIntervalSinceDate(startTime)
                 if currentTime > timeout {
-                    break
+                    throw WaitConditionError.Timeout
                 }
             }
         } else {

    return false
}

extension NSObject {
    /**
    Pumps the run loop while waiting for the given conditions check to return true, or the timeout has

    - parameter timeout: The timeout, in seconds.
    - parameter conditionsCheck: A block that performs the condition check and returns true/false.
    */
    public func waitForConditionsWithTimeout(timeout: NSTimeInterval, conditionsCheck: () -> Bool) throws {
        if isInUnitTest() {
            var condition = false
            let startTime = NSDate()
