diff --git a/Example/Tests/LKAlertControllerTests.swift b/Example/Tests/LKAlertControllerTests.swift index d8011cb..da88cc0 100644 --- a/Example/Tests/LKAlertControllerTests.swift +++ b/Example/Tests/LKAlertControllerTests.swift @@ -141,6 +141,26 @@ class LKAlertControllerTests: XCTestCase { waitForExpectationsWithTimeout(0.5, handler: nil) } + + func testDelay() { + let expectation = expectationWithDescription("Delay testing") + + let startTime = NSDate() + + LKAlertController.overrideShowForTesting { (style, title, message, actions, fields) -> Void in + + let endTime = NSDate() + let delayTime = Int(startTime.timeIntervalSinceDate(endTime)) + + XCTAssertEqual(delayTime, 5) + + expectation.fulfill() + } + + Alert(title: "Title", message: "Message").addAction("Cancel").delay(5).show() + + waitForExpectationsWithTimeout(6, handler: nil) + } }