Skip to content

Commit

Permalink
Fixed that damn old MOC problem
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerhard Schraml authored and Gerhard Schraml committed Dec 15, 2009
1 parent 793a186 commit 8b62d10
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
3 changes: 3 additions & 0 deletions Classes/Entities/Folder.m
Expand Up @@ -170,11 +170,14 @@ - (NSManagedObjectContext *)managedObjectContext
NSManagedObjectContext *managedObjectContext;
@try
{
ALog(@"FUCK 1");
delegate = [[UIApplication sharedApplication] delegate];
managedObjectContext = [delegate managedObjectContext];
ALog(@"FUCK 2");
}
@catch (NSException *exception) {
// Test target, create new AppDelegate
ALog(@"FUCK 3");
delegate = [[[Less2DoAppDelegate alloc] init] autorelease];
managedObjectContext = [delegate managedObjectContext];
}
Expand Down
6 changes: 6 additions & 0 deletions Less2Do.xcodeproj/project.pbxproj
Expand Up @@ -79,6 +79,7 @@
A36CF97510D639E4007482E3 /* Folder.m in Sources */ = {isa = PBXBuildFile; fileRef = A3E3389310BC5C6D004F0F39 /* Folder.m */; };
A36CFA6710D64524007482E3 /* TaskTest.m in Sources */ = {isa = PBXBuildFile; fileRef = A36CFA6610D64524007482E3 /* TaskTest.m */; };
A36CFA8010D64748007482E3 /* Task.m in Sources */ = {isa = PBXBuildFile; fileRef = A3E3389710BC5C6D004F0F39 /* Task.m */; };
A37069C410D7919200E6D556 /* CustomGHUnitAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = A37069C310D7919200E6D556 /* CustomGHUnitAppDelegate.m */; };
A38B3AB610BFF91100D5D87F /* CoreLocation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A38B3AB510BFF91100D5D87F /* CoreLocation.framework */; };
A38B3AC510BFFA9200D5D87F /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765A40DF7441C002DB57D /* CoreGraphics.framework */; };
A38B3AC610BFFAA000D5D87F /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; };
Expand Down Expand Up @@ -254,6 +255,8 @@
A34471E710BF239000851DCD /* DAOError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DAOError.h; sourceTree = "<group>"; };
A36CF93710D634C9007482E3 /* FolderTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FolderTest.m; sourceTree = "<group>"; };
A36CFA6610D64524007482E3 /* TaskTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TaskTest.m; sourceTree = "<group>"; };
A37069C210D7919200E6D556 /* CustomGHUnitAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CustomGHUnitAppDelegate.h; sourceTree = "<group>"; };
A37069C310D7919200E6D556 /* CustomGHUnitAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CustomGHUnitAppDelegate.m; sourceTree = "<group>"; };
A38B3AB510BFF91100D5D87F /* CoreLocation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreLocation.framework; path = System/Library/Frameworks/CoreLocation.framework; sourceTree = SDKROOT; };
A38B3ABF10BFFA8000D5D87F /* Tests.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Tests.app; sourceTree = BUILT_PRODUCTS_DIR; };
A38B3AC110BFFA8000D5D87F /* Tests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Tests-Info.plist"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -708,6 +711,8 @@
A38B3AE010BFFB8800D5D87F /* GHUnit */,
A36CF93710D634C9007482E3 /* FolderTest.m */,
A36CFA6610D64524007482E3 /* TaskTest.m */,
A37069C210D7919200E6D556 /* CustomGHUnitAppDelegate.h */,
A37069C310D7919200E6D556 /* CustomGHUnitAppDelegate.m */,
);
name = Tests;
sourceTree = "<group>";
Expand Down Expand Up @@ -1038,6 +1043,7 @@
A38B3B0510BFFC9E00D5D87F /* ContextDAOTest.m in Sources */,
A36CF93810D634C9007482E3 /* FolderTest.m in Sources */,
A36CFA6710D64524007482E3 /* TaskTest.m in Sources */,
A37069C410D7919200E6D556 /* CustomGHUnitAppDelegate.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
12 changes: 5 additions & 7 deletions TaskTest.m
Expand Up @@ -8,10 +8,9 @@

#import "Task.h"
#import "Folder.h"
#import "Less2DoAppDelegate.h";
#import "CustomGHUnitAppDelegate.h";

@interface TaskTest : GHTestCase {
Less2DoAppDelegate* appDelegate;
NSManagedObjectContext* managedObjectContext;
}

Expand All @@ -21,9 +20,9 @@ @implementation TaskTest

- (void)setUp {

/* delete all folders from the persistent store */
appDelegate = [[Less2DoAppDelegate alloc] init];
managedObjectContext = [appDelegate managedObjectContext];
/* delete all Tasks from the persistent store */
CustomGHUnitAppDelegate *delegate = [[UIApplication sharedApplication] delegate];
managedObjectContext = [delegate managedObjectContext];

NSFetchRequest *request = [[NSFetchRequest alloc] init];
[request setEntity:[NSEntityDescription entityForName:@"Task" inManagedObjectContext:managedObjectContext]];
Expand All @@ -40,8 +39,7 @@ - (void)setUp {
}

- (void)tearDown {
[appDelegate release];
appDelegate = nil;
/* do nothing */
}

/* test all tasks */
Expand Down
2 changes: 1 addition & 1 deletion libGHUnitIPhone3_0-0.4.13/GHUnitIPhoneTestMain.m
Expand Up @@ -52,7 +52,7 @@ int main(int argc, char *argv[]) {
if (getenv("GHUNIT_CLI")) {
retVal = [GHTestRunner run];
} else {
retVal = UIApplicationMain(argc, argv, nil, @"GHUnitIPhoneAppDelegate");
retVal = UIApplicationMain(argc, argv, nil, @"CustomGHUnitAppDelegate");
}
[pool release];
return retVal;
Expand Down

0 comments on commit 8b62d10

Please sign in to comment.