diff --git a/src/tests/FBCacheTests.m b/src/tests/FBCacheTests.m index f5ef422b83..4e2ebd75a5 100644 --- a/src/tests/FBCacheTests.m +++ b/src/tests/FBCacheTests.m @@ -113,7 +113,7 @@ - (void)cacheIndex:(FBCacheIndex*)cacheIndex { NSString* filePath = [_dataCachePath stringByAppendingPathComponent:name]; dispatch_async(_fileQueue, ^{ - [[NSFileManager defaultManager] + [[NSFileManager defaultManager] removeItemAtPath:filePath error:nil]; }); @@ -237,6 +237,7 @@ - (void)testDataPersistence // Wait for the queue to finish dispatch_sync(cacheIndex.databaseQueue, ^{}); + dispatch_sync(_fileQueue, ^{}); STAssertEquals( cacheIndex.currentDiskUsage, fileSize*numberOfFiles, @@ -333,10 +334,11 @@ - (void)testDeletingUsedData NSString *filePath = [tempFolder stringByAppendingPathComponent:fileName]; - // Flush the write queue + // Flush the write queues dispatch_sync(cacheIndex.databaseQueue, ^{}); + dispatch_sync(_fileQueue, ^{}); - NSData *dataFromFile = [NSData + NSData *dataFromFile = [NSData dataWithContentsOfFile:filePath options:NSDataReadingMappedAlways | NSDataReadingUncached error:nil]; @@ -356,7 +358,7 @@ - (void)testDeletingUsedData [cacheIndex removeEntryForKey:@"test1"]; dispatch_sync(cacheIndex.databaseQueue, ^{}); dispatch_sync(_fileQueue, ^{}); - + BOOL fileExists = [[NSFileManager defaultManager] fileExistsAtPath:filePath]; STAssertFalse(fileExists, @"File wasn't deleted at %@", filePath);