be a JSON array"); NSArray *touchedArticles = [WAArticle insertOrUpdateObjectsUsingContext:context withRemoteResponse:changedArticleReps usingMapping:nil options:IRManagedObjectOptionIndividualOperations]; WAArticle *article = [touchedArticles objectAtIndex:0]; STAssertEquals((NSUInteger)20, [article.files count], @"attachments should be decorated to 20"); NSFetchRequest *fetchRequest = [[WADataStore defaultStore] newFetchRequestForFilesInArticle:article]; NSFetchedResultsController *fetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest managedObjectContext:article.managedObjectContext sectionNameKeyPath:nil cacheName:nil]; NSError *fetchError = nil; if (![fetchedResultsController performFetch:&fetchError]) NSLog(@"Error fetching: %@", fetchError); STAssertEquals((NSUInteger)20, [[fetchedResultsController fetchedObjects] count], @"Should be 20."); for (WAFile *photo in [fetchedResultsController fetchedObjects]) { STAssertEqualObjects(@"public.jpeg", photo.resourceType, @"Type must be jpeg."); STAssertEqualObjects(@"image", photo.remoteResourceType, @"Must be an image."); STAssertNotNil(photo.smallThumbnailURL, @"Small thumbnail required"); STAssertNotNil(photo.thumbnailURL, @"Medium thumbnail required"); } Saturday, October 20, 12