Sfoglia il codice sorgente

Moved to apple domain to attempt to improve test suite reliability.

Christian Noon 9 anni fa
parent
commit
65a2766c36
1 ha cambiato i file con 8 aggiunte e 4 eliminazioni
  1. 8 4
      Tests/NetworkReachabilityManagerTests.swift

+ 8 - 4
Tests/NetworkReachabilityManagerTests.swift

@@ -106,18 +106,22 @@ class NetworkReachabilityManagerTestCase: BaseTestCase {
 
 
     func testThatHostManagerIsNotifiedWhenStartListeningIsCalled() {
     func testThatHostManagerIsNotifiedWhenStartListeningIsCalled() {
         // Given
         // Given
-        let manager = NetworkReachabilityManager(host: "localhost")
-        let expectation = expectationWithDescription("listener closure should be executed")
+        guard let manager = NetworkReachabilityManager(host: "store.apple.com") else {
+            XCTFail("manager should NOT be nil")
+            return
+        }
 
 
+        let expectation = expectationWithDescription("listener closure should be executed")
         var networkReachabilityStatus: NetworkReachabilityManager.NetworkReachabilityStatus?
         var networkReachabilityStatus: NetworkReachabilityManager.NetworkReachabilityStatus?
 
 
-        manager?.listener = { status in
+        manager.listener = { status in
+            guard networkReachabilityStatus == nil else { return }
             networkReachabilityStatus = status
             networkReachabilityStatus = status
             expectation.fulfill()
             expectation.fulfill()
         }
         }
 
 
         // When
         // When
-        manager?.startListening()
+        manager.startListening()
         waitForExpectationsWithTimeout(timeout, handler: nil)
         waitForExpectationsWithTimeout(timeout, handler: nil)
 
 
         // Then
         // Then