             expectation.fulfill()
             XCTAssertEqual($0, data)
         })
-        
-        dispatch_sync(sut.cacheQueue) {
-            self.waitForExpectationsWithTimeout(0, handler: nil)
-            
-            let attributes = try! fileManager.attributesOfItemAtPath(path)
-            let accessDate = attributes[NSFileModificationDate] as! NSDate
-            let now = NSDate()
-            let interval = accessDate.timeIntervalSinceDate(now)
-            XCTAssertEqualWithAccuracy(interval, 0, accuracy: 1)
-        }
-    }
-    
+
+        dispatch_sync(sut.cacheQueue) {}
+        self.waitForExpectationsWithTimeout(1, handler: nil)
+
+        let attributes = try! fileManager.attributesOfItemAtPath(path)
+        let accessDate = attributes[NSFileModificationDate] as! NSDate
+        let interval = accessDate.timeIntervalSinceDate(now)
+        XCTAssertEqualWithAccuracy(interval, 0, accuracy: 1)
+    }
+
     func testUpdateAccessDateFileInDisk() {
         let now = NSDate()
         let data = NSData.dataWithLength(10)

            expectation.fulfill()
            XCTAssertEqual($0, data)
        })
        
        self.waitForExpectationsWithTimeout(1, handler: nil)
    }
    

            XCTFail("Expected failure")
            expectation.fulfill()
        }

        dispatch_sync(sut.cacheQueue) {}
        self.waitForExpectationsWithTimeout(1, handler: nil)
    }
    
