浏览代码

Removed all os checks as they proved to be unnecessary.

Christian Noon 10 年之前
父节点
当前提交
7d3cc25d26
共有 1 个文件被更改,包括 15 次插入27 次删除
  1. 15 27
      Tests/CacheTests.swift

+ 15 - 27
Tests/CacheTests.swift

@@ -256,12 +256,7 @@ class CacheTestCase: BaseTestCase {
         XCTAssertNotNil(maxAgeNonExpiredResponse, "\(CacheControl.MaxAgeNonExpired) response should not be nil")
         XCTAssertNotNil(maxAgeNonExpiredResponse, "\(CacheControl.MaxAgeNonExpired) response should not be nil")
         XCTAssertNotNil(maxAgeExpiredResponse, "\(CacheControl.MaxAgeExpired) response should not be nil")
         XCTAssertNotNil(maxAgeExpiredResponse, "\(CacheControl.MaxAgeExpired) response should not be nil")
         XCTAssertNotNil(noCacheResponse, "\(CacheControl.NoCache) response should not be nil")
         XCTAssertNotNil(noCacheResponse, "\(CacheControl.NoCache) response should not be nil")
-
-        #if os(OSX)
-            XCTAssertNil(noStoreResponse, "\(CacheControl.NoStore) response should be nil")
-        #else
-            XCTAssertNotNil(noStoreResponse, "\(CacheControl.NoStore) response should not be nil")
-        #endif
+        XCTAssertNil(noStoreResponse, "\(CacheControl.NoStore) response should be nil")
     }
     }
 
 
     func testDefaultCachePolicy() {
     func testDefaultCachePolicy() {
@@ -294,12 +289,7 @@ class CacheTestCase: BaseTestCase {
         executeTest(cachePolicy: cachePolicy, cacheControl: CacheControl.MaxAgeNonExpired, shouldReturnCachedResponse: true)
         executeTest(cachePolicy: cachePolicy, cacheControl: CacheControl.MaxAgeNonExpired, shouldReturnCachedResponse: true)
         executeTest(cachePolicy: cachePolicy, cacheControl: CacheControl.MaxAgeExpired, shouldReturnCachedResponse: true)
         executeTest(cachePolicy: cachePolicy, cacheControl: CacheControl.MaxAgeExpired, shouldReturnCachedResponse: true)
         executeTest(cachePolicy: cachePolicy, cacheControl: CacheControl.NoCache, shouldReturnCachedResponse: true)
         executeTest(cachePolicy: cachePolicy, cacheControl: CacheControl.NoCache, shouldReturnCachedResponse: true)
-
-        #if os(OSX)
-            executeTest(cachePolicy: cachePolicy, cacheControl: CacheControl.NoStore, shouldReturnCachedResponse: false)
-        #else
-            executeTest(cachePolicy: cachePolicy, cacheControl: CacheControl.NoStore, shouldReturnCachedResponse: true)
-        #endif
+        executeTest(cachePolicy: cachePolicy, cacheControl: CacheControl.NoStore, shouldReturnCachedResponse: false)
     }
     }
 
 
     func testUseLocalCacheDataAndDontLoadFromNetworkPolicy() {
     func testUseLocalCacheDataAndDontLoadFromNetworkPolicy() {
@@ -311,23 +301,21 @@ class CacheTestCase: BaseTestCase {
         executeTest(cachePolicy: cachePolicy, cacheControl: CacheControl.MaxAgeExpired, shouldReturnCachedResponse: true)
         executeTest(cachePolicy: cachePolicy, cacheControl: CacheControl.MaxAgeExpired, shouldReturnCachedResponse: true)
         executeTest(cachePolicy: cachePolicy, cacheControl: CacheControl.NoCache, shouldReturnCachedResponse: true)
         executeTest(cachePolicy: cachePolicy, cacheControl: CacheControl.NoCache, shouldReturnCachedResponse: true)
 
 
-        #if os(OSX)
-            // Given
-            let expectation = expectationWithDescription("GET request to httpbin")
-            var response: NSHTTPURLResponse?
+        // Execute Test - CacheControl.NoStore
 
 
-            // When
-            let request = startRequest(cacheControl: CacheControl.NoStore, cachePolicy: cachePolicy) { _, responseResponse in
-                response = responseResponse
-                expectation.fulfill()
-            }
+        // Given
+        let expectation = expectationWithDescription("GET request to httpbin")
+        var response: NSHTTPURLResponse?
 
 
-            waitForExpectationsWithTimeout(self.defaultTimeout, handler: nil)
+        // When
+        let request = startRequest(cacheControl: CacheControl.NoStore, cachePolicy: cachePolicy) { _, responseResponse in
+            response = responseResponse
+            expectation.fulfill()
+        }
 
 
-            // Then
-            XCTAssertNil(response, "response should be nil")
-        #else
-            executeTest(cachePolicy: cachePolicy, cacheControl: CacheControl.NoStore, shouldReturnCachedResponse: true)
-        #endif
+        waitForExpectationsWithTimeout(self.defaultTimeout, handler: nil)
+
+        // Then
+        XCTAssertNil(response, "response should be nil")
     }
     }
 }
 }