I would like to test my repositories that use MagicalRecord framework.
I'm doing the following (from this article : http://www.cimgf.com/2012/05/15/unit-testing-with-core-data/ ) :
@interface OMSTests : GHTestCase
@end
@implementation OMSTests
- (void)setUp;
{
[MagicalRecord setDefaultModelFromClass:[self class]];
[MagicalRecord setupCoreDataStackWithInMemoryStore];
}
- (void)tearDown;
{
[MagicalRecord cleanUp];
}
-(void)testXXX {
NSManagedObjectContext * context = [NSManagedObjectContext defaultContext];
[context save]; // context is not set 0x000000000000
OMSPointsEventEntity * entity = [OMSPointsEventEntity createEntity];
}
@end
I have the following error message when creating the entity :
Name: NSInternalInconsistencyException
File: Unknown
Line: Unknown
Reason: [RKManagedObjectStore defaultObjectStore] cannot be nil
Anyone can help me to find why I don't have a context instanciated ? I did not find useful documentation for this issue...