Skip to content

Commit

Permalink
Adding test for the delay
Browse files Browse the repository at this point in the history
  • Loading branch information
Erik Sargent committed May 9, 2016
1 parent 27a1ee3 commit 01cd5f0
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions Example/Tests/LKAlertControllerTests.swift
Expand Up @@ -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)
}
}


Expand Down

0 comments on commit 01cd5f0

Please sign in to comment.