Created
October 10, 2012 13:52
-
-
Save pilky/3865781 to your computer and use it in GitHub Desktop.
Test Managed Object Context
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//HEADER | |
typedef NSArray *(^M3TestFetchRequestBlock)(NSFetchRequest *, NSError **); | |
@interface M3TestManagedObjectContext : NSManagedObjectContext | |
@property (copy) M3TestFetchRequestBlock fetchRequestBlock; | |
@end | |
//IMPLEMENTATION | |
@implementation M3TestManagedObjectContext | |
- (NSArray *)executeFetchRequest:(NSFetchRequest *)aRequest error:(NSError *__autoreleasing *)aError { | |
if (self.fetchRequestBlock) { | |
return self.fetchRequestBlock(aRequest, aError); | |
} | |
return [super executeFetchRequest:aRequest error:aError]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment