Browse Source

Resolved deinitialization test random failures by handling state race condition.

Christian Noon 10 years ago
parent
commit
609eb9e78d
1 changed files with 2 additions and 1 deletions
  1. 2 1
      Tests/ManagerTests.swift

+ 2 - 1
Tests/ManagerTests.swift

@@ -83,7 +83,8 @@ class ManagerTestCase: BaseTestCase {
         manager = nil
 
         // Then
-        XCTAssertEqual(request.task.state.rawValue, NSURLSessionTaskState.Canceling.rawValue, "request task state should be '.Canceling'")
+        let state = request.task.state
+        XCTAssertTrue(state == .Canceling || state == .Completed, "state should be .Canceling or .Completed")
         XCTAssertNil(manager, "manager should be nil")
     }
 }