Browse Source

Added guard to timestamp to avoid crashing the test suite.

Christian Noon 10 years ago
parent
commit
9f4d987873
1 changed files with 4 additions and 1 deletions
  1. 4 1
      Tests/CacheTests.swift

+ 4 - 1
Tests/CacheTests.swift

@@ -215,7 +215,10 @@ class CacheTestCase: BaseTestCase {
     }
 
     func verifyResponse(response: NSHTTPURLResponse?, forCacheControl cacheControl: String, isCachedResponse: Bool) {
-        let cachedResponseTimestamp = timestamps[cacheControl]!
+        guard let cachedResponseTimestamp = timestamps[cacheControl] else {
+            XCTFail("cached response timestamp should not be nil")
+            return
+        }
 
         if let
             response = response,