Skip to content

Commit

Permalink
More improvements to the delay test
Browse files Browse the repository at this point in the history
  • Loading branch information
Erik Sargent committed May 9, 2016
1 parent 4762a47 commit 94a19de
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Example/Tests/LKAlertControllerTests.swift
Expand Up @@ -145,18 +145,20 @@ class LKAlertControllerTests: XCTestCase {
func testDelay() {
let expectation = expectationWithDescription("Delay testing")

let startTime = NSDate()
var startTime = NSDate()

LKAlertController.overrideShowForTesting { (style, title, message, actions, fields) -> Void in

let endTime = NSDate()
let delayTime = Int(endTime.timeIntervalSinceDate(startTime))
let delayTime = Int(round(endTime.timeIntervalSinceDate(startTime)))

XCTAssertEqual(delayTime, 5)

expectation.fulfill()
}

startTime = NSDate()

Alert(title: "Title", message: "Message").addAction("Cancel").delay(5).show()

waitForExpectationsWithTimeout(6, handler: nil)
Expand Down

0 comments on commit 94a19de

Please sign in to comment.