Created
February 24, 2013 02:54
-
-
Save acoomans/5022376 to your computer and use it in GitHub Desktop.
Test case class for core data
This file contains 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
// | |
// CPModelTestCase.h | |
// CoursePad | |
// | |
// Created by Arnaud Coomans on 16/01/13. | |
// Copyright (c) 2013 Archer. All rights reserved. | |
// | |
#import <SenTestingKit/SenTestingKit.h> | |
@interface CPModelTestCase : SenTestCase | |
@property (nonatomic, retain) NSManagedObjectContext *managedObjectContext; | |
@end |
This file contains 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
// | |
// CPModelTestCase.m | |
// CoursePad | |
// | |
// Created by Arnaud Coomans on 16/01/13. | |
// Copyright (c) 2013 Archer. All rights reserved. | |
// | |
#import "CPModelTestCase.h" | |
@implementation CPModelTestCase | |
- (void)setUp { | |
NSManagedObjectModel *managedObjectModel = [NSManagedObjectModel mergedModelFromBundles:nil]; | |
NSPersistentStoreCoordinator *persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:managedObjectModel]; | |
[persistentStoreCoordinator addPersistentStoreWithType:NSInMemoryStoreType configuration:nil URL:nil options:nil error:NULL]; | |
self.managedObjectContext = [[NSManagedObjectContext alloc] init]; | |
self.managedObjectContext.persistentStoreCoordinator = persistentStoreCoordinator; | |
} | |
- (void)tearDown { | |
self.managedObjectContext = nil; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment