Bläddra i källkod

Add force clean cache before button tests

onevcat 10 år sedan
förälder
incheckning
8ab5a7a9fc
1 ändrade filer med 4 tillägg och 1 borttagningar
  1. 4 1
      KingfisherTests/UIButtonExtensionTests.swift

+ 4 - 1
KingfisherTests/UIButtonExtensionTests.swift

@@ -68,6 +68,9 @@ class UIButtonExtensionTests: XCTestCase {
         let URL = NSURL(string: URLString)!
         
         var progressBlockIsCalled = false
+        
+        cleanDefaultCache()
+        
         button.kf_setImageWithURL(URL, forState: UIControlState.Highlighted, placeholderImage: nil, optionsInfo: nil, progressBlock: { (receivedSize, totalSize) -> () in
             progressBlockIsCalled = true
         }) { (image, error, cacheType, imageURL) -> () in
@@ -78,7 +81,7 @@ class UIButtonExtensionTests: XCTestCase {
             XCTAssert(image! == testImage, "Downloaded image should be the same as test image.")
             XCTAssert(self.button.imageForState(UIControlState.Highlighted)! == testImage, "Downloaded image should be already set to the image for state")
             XCTAssert(self.button.kf_webURLForState(UIControlState.Highlighted) == imageURL, "Web URL should equal to the downloaded url.")
-            XCTAssert(cacheType == .None, "cacheType should be .None since the image was just downloaded.")
+            XCTAssert(cacheType == .None, "The cache type should be none here. This image was just downloaded. But now is: \(cacheType)")
         }
         waitForExpectationsWithTimeout(5, handler: nil)
     }