mirror of
https://github.com/zhigang1992/MagicalRecord.git
synced 2026-01-12 17:32:18 +08:00
Merge branch 'release/2.0.7'
This commit is contained in:
@@ -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 @@
|
||||
{
|
||||
[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 reset_action_queue(void)
|
||||
|
||||
if ([localContext hasChanges])
|
||||
{
|
||||
[localContext MR_saveNestedContextsErrorHandler:errorHandler];
|
||||
[localContext MR_saveErrorHandler:errorHandler];
|
||||
}
|
||||
|
||||
if (completion)
|
||||
|
||||
@@ -65,4 +65,21 @@
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user