Permalink
Browse files

Merge branch 'release/2.0.7'

  • Loading branch information...
2 parents 835b467 + 601869e commit 58f463d2817ef8e9a173f901b9d1bdf274b0a6a1 @blackgold9 blackgold9 committed Oct 16, 2012
View
@@ -1,11 +1,11 @@
Pod::Spec.new do |s|
s.name = 'MagicalRecord'
- s.version = '2.0.6'
+ s.version = '2.0.7'
s.license = 'MIT'
s.summary = 'Super Awesome Easy Fetching for Core Data 1!!!11!!!!1!.'
s.homepage = 'http://github.com/magicalpanda/MagicalRecord'
s.author = { 'Saul Mora' => 'saul@magicalpanda.com' }
- s.source = { :git => 'https://github.com/magicalpanda/MagicalRecord.git', :tag => '2.0.6' }
+ s.source = { :git => 'https://github.com/magicalpanda/MagicalRecord.git', :tag => '2.0.7' }
s.description = 'Handy fetching, threading and data import helpers to make Core Data a little easier to use.'
s.source_files = 'MagicalRecord/**/*.{h,m}'
s.framework = 'CoreData'
@@ -95,13 +95,13 @@ - (void) MR_saveErrorHandler:(void (^)(NSError *))errorCallback;
{
[self performBlockAndWait:^{
[self MR_saveWithErrorCallback:errorCallback];
+
+ if (self.parentContext) {
+ [[self parentContext] performBlockAndWait:^{
+ [[self parentContext] MR_saveErrorHandler:errorCallback];
+ }];
+ }
}];
-
- if (self == [[self class] MR_defaultContext])
- {
- // Since this is a synchronous call, I made the background context save synchronous as well to reflect the intent.
- [[[self class] MR_rootSavingContext] MR_saveErrorHandler:errorCallback];
- }
}
- (void) MR_saveInBackgroundCompletion:(void (^)(void))completion;
@@ -66,7 +66,7 @@ + (void) saveWithBlock:(void (^)(NSManagedObjectContext *localContext))block com
if ([localContext hasChanges])
{
- [localContext MR_saveNestedContextsErrorHandler:errorHandler];
+ [localContext MR_saveErrorHandler:errorHandler];
}
if (completion)
@@ -65,4 +65,21 @@ - (void)testBackgroundSavesActuallySave
expect([fetchedObject hasChanges]).to.beFalsy();
}
+- (void)testCurrentThreadSavesActuallySave
+{
+ __block NSManagedObjectID *objectId;
+ __block NSManagedObject *fetchedObject;
+ [MagicalRecord saveWithBlock:^(NSManagedObjectContext *localContext) {
+ NSManagedObject *inserted = [SingleEntityWithNoRelationships MR_createInContext:localContext];
+ expect([inserted hasChanges]).to.beTruthy();
+ [localContext obtainPermanentIDsForObjects:@[inserted] error:nil];
+ objectId = inserted.objectID;
+ }];
+
+ fetchedObject = [[NSManagedObjectContext MR_rootSavingContext] objectWithID:objectId];
+
+ expect(fetchedObject).toNot.beNil();
+ expect([fetchedObject hasChanges]).to.beFalsy();
+}
+
@end

1 comment on commit 58f463d

Contributor

tonyarnold commented on 58f463d Oct 16, 2012

Don't forget to push your new tag as well! 😃

Please sign in to comment.