Created
September 5, 2017 21:10
-
-
Save ncreated/b4f751555f79ae54cf929dc6d742f643 to your computer and use it in GitHub Desktop.
Revisions
-
ncreated created this gist
Sep 5, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,28 @@ func test_givenTask_whenExecuted_itUpdatesStatusInSpecificOrder() { let task = Task() let mockDelegate = MockTaskStatusDelegate() task.statusDelegate = mockDelegate let downloadingExpectation = self.expectation(description: "status changes to .downloading") let processingExpectation = self.expectation(description: "status changes to .processing") let finishedExpectation = self.expectation(description: "status changes to .finished") mockDelegate.didCall_taskDidChangeStatus = { (_, status) in switch status { case .downloading: downloadingExpectation.fulfill() case .processing: processingExpectation.fulfill() case .finished: finishedExpectation.fulfill() default: XCTFail() } } task.execute() wait(for: [downloadingExpectation, processingExpectation, finishedExpectation], timeout: 0.5, enforceOrder: true) }