Permalink
Browse files

Fix: Set the default store properly when creating a new default context

  • Loading branch information...
1 parent 6de353f commit 07538d5a1a0d60aace0e55ee57e6b26fc85b6c2f @casademora casademora committed Dec 10, 2011
Showing with 267 additions and 4 deletions.
  1. +1 −1 Source/Categories/NSPersistentStoreCoordinator+MagicalRecord.m
  2. +10 −0 Unit Tests/Fixtures/iOS/TestEntities/_AbstractRelatedEntity.h
  3. +10 −0 Unit Tests/Fixtures/iOS/TestEntities/_AbstractRelatedEntity.m
  4. +10 −0 Unit Tests/Fixtures/iOS/TestEntities/_ConcreteRelatedEntity.h
  5. +10 −0 Unit Tests/Fixtures/iOS/TestEntities/_ConcreteRelatedEntity.m
  6. +9 −0 Unit Tests/Fixtures/iOS/TestEntities/_DifferentClassNameMapping.h
  7. +9 −0 Unit Tests/Fixtures/iOS/TestEntities/_DifferentClassNameMapping.m
  8. +13 −0 Unit Tests/Fixtures/iOS/TestEntities/_MappedEntity.h
  9. +13 −0 Unit Tests/Fixtures/iOS/TestEntities/_MappedEntity.m
  10. +11 −0 Unit Tests/Fixtures/iOS/TestEntities/_SingleEntityRelatedToManyMappedEntitiesUsingMappedPrimaryKey.h
  11. +11 −0 Unit Tests/Fixtures/iOS/TestEntities/_SingleEntityRelatedToManyMappedEntitiesUsingMappedPrimaryKey.m
  12. +11 −0 Unit Tests/Fixtures/iOS/TestEntities/_SingleEntityRelatedToMappedEntityUsingDefaults.h
  13. +11 −0 Unit Tests/Fixtures/iOS/TestEntities/_SingleEntityRelatedToMappedEntityUsingDefaults.m
  14. +10 −0 Unit Tests/Fixtures/iOS/TestEntities/_SingleEntityRelatedToMappedEntityUsingMappedPrimaryKey.h
  15. +10 −0 Unit Tests/Fixtures/iOS/TestEntities/_SingleEntityRelatedToMappedEntityUsingMappedPrimaryKey.m
  16. +10 −0 Unit Tests/Fixtures/iOS/TestEntities/_SingleEntityRelatedToMappedEntityWithNestedMappedAttributes.h
  17. +10 −0 Unit Tests/Fixtures/iOS/TestEntities/_SingleEntityRelatedToMappedEntityWithNestedMappedAttributes.m
  18. +11 −0 Unit Tests/Fixtures/iOS/TestEntities/_SingleEntityRelatedToMappedEntityWithSecondaryMappings.h
  19. +11 −0 Unit Tests/Fixtures/iOS/TestEntities/_SingleEntityRelatedToMappedEntityWithSecondaryMappings.m
  20. +23 −0 Unit Tests/Fixtures/iOS/TestEntities/_SingleEntityWithNoRelationships.h
  21. +23 −0 Unit Tests/Fixtures/iOS/TestEntities/_SingleEntityWithNoRelationships.m
  22. +14 −0 Unit Tests/Fixtures/iOS/TestEntities/_SingleRelatedEntity.h
  23. +14 −0 Unit Tests/Fixtures/iOS/TestEntities/_SingleRelatedEntity.m
  24. +2 −3 Unit Tests/MagicalRecordHelperTests.m
@@ -22,7 +22,7 @@ + (NSPersistentStoreCoordinator *) MR_defaultStoreCoordinator
{
if (defaultCoordinator_ == nil && [MagicalRecordHelpers shouldAutoCreateDefaultPersistentStoreCoordinator])
{
- defaultCoordinator_ = [self MR_newPersistentStoreCoordinator];
+ [self MR_setDefaultStoreCoordinator:[self MR_newPersistentStoreCoordinator]];
}
return defaultCoordinator_;
}
@@ -4,6 +4,16 @@
#import <CoreData/CoreData.h>
+extern const struct AbstractRelatedEntityAttributes {
+ NSString *sampleBaseAttribute;
+} AbstractRelatedEntityAttributes;
+
+extern const struct AbstractRelatedEntityRelationships {
+} AbstractRelatedEntityRelationships;
+
+extern const struct AbstractRelatedEntityFetchedProperties {
+} AbstractRelatedEntityFetchedProperties;
+
@@ -3,6 +3,16 @@
#import "_AbstractRelatedEntity.h"
+const struct AbstractRelatedEntityAttributes AbstractRelatedEntityAttributes = {
+ .sampleBaseAttribute = @"sampleBaseAttribute",
+};
+
+const struct AbstractRelatedEntityRelationships AbstractRelatedEntityRelationships = {
+};
+
+const struct AbstractRelatedEntityFetchedProperties AbstractRelatedEntityFetchedProperties = {
+};
+
@implementation AbstractRelatedEntityID
@end
@@ -4,6 +4,16 @@
#import <CoreData/CoreData.h>
#import "AbstractRelatedEntity.h"
+extern const struct ConcreteRelatedEntityAttributes {
+ NSString *sampleConcreteAttribute;
+} ConcreteRelatedEntityAttributes;
+
+extern const struct ConcreteRelatedEntityRelationships {
+} ConcreteRelatedEntityRelationships;
+
+extern const struct ConcreteRelatedEntityFetchedProperties {
+} ConcreteRelatedEntityFetchedProperties;
+
@@ -3,6 +3,16 @@
#import "_ConcreteRelatedEntity.h"
+const struct ConcreteRelatedEntityAttributes ConcreteRelatedEntityAttributes = {
+ .sampleConcreteAttribute = @"sampleConcreteAttribute",
+};
+
+const struct ConcreteRelatedEntityRelationships ConcreteRelatedEntityRelationships = {
+};
+
+const struct ConcreteRelatedEntityFetchedProperties ConcreteRelatedEntityFetchedProperties = {
+};
+
@implementation ConcreteRelatedEntityID
@end
@@ -4,6 +4,15 @@
#import <CoreData/CoreData.h>
+extern const struct DifferentClassNameMappingAttributes {
+} DifferentClassNameMappingAttributes;
+
+extern const struct DifferentClassNameMappingRelationships {
+} DifferentClassNameMappingRelationships;
+
+extern const struct DifferentClassNameMappingFetchedProperties {
+} DifferentClassNameMappingFetchedProperties;
+
@interface DifferentClassNameMappingID : NSManagedObjectID {}
@@ -3,6 +3,15 @@
#import "_DifferentClassNameMapping.h"
+const struct DifferentClassNameMappingAttributes DifferentClassNameMappingAttributes = {
+};
+
+const struct DifferentClassNameMappingRelationships DifferentClassNameMappingRelationships = {
+};
+
+const struct DifferentClassNameMappingFetchedProperties DifferentClassNameMappingFetchedProperties = {
+};
+
@implementation DifferentClassNameMappingID
@end
@@ -4,6 +4,19 @@
#import <CoreData/CoreData.h>
+extern const struct MappedEntityAttributes {
+ NSString *mappedEntityID;
+ NSString *nestedAttribute;
+ NSString *sampleAttribute;
+ NSString *testMappedEntityID;
+} MappedEntityAttributes;
+
+extern const struct MappedEntityRelationships {
+} MappedEntityRelationships;
+
+extern const struct MappedEntityFetchedProperties {
+} MappedEntityFetchedProperties;
+
@@ -3,6 +3,19 @@
#import "_MappedEntity.h"
+const struct MappedEntityAttributes MappedEntityAttributes = {
+ .mappedEntityID = @"mappedEntityID",
+ .nestedAttribute = @"nestedAttribute",
+ .sampleAttribute = @"sampleAttribute",
+ .testMappedEntityID = @"testMappedEntityID",
+};
+
+const struct MappedEntityRelationships MappedEntityRelationships = {
+};
+
+const struct MappedEntityFetchedProperties MappedEntityFetchedProperties = {
+};
+
@implementation MappedEntityID
@end
@@ -4,6 +4,17 @@
#import <CoreData/CoreData.h>
+extern const struct SingleEntityRelatedToManyMappedEntitiesUsingMappedPrimaryKeyAttributes {
+ NSString *testPrimaryKey;
+} SingleEntityRelatedToManyMappedEntitiesUsingMappedPrimaryKeyAttributes;
+
+extern const struct SingleEntityRelatedToManyMappedEntitiesUsingMappedPrimaryKeyRelationships {
+ NSString *mappedEntities;
+} SingleEntityRelatedToManyMappedEntitiesUsingMappedPrimaryKeyRelationships;
+
+extern const struct SingleEntityRelatedToManyMappedEntitiesUsingMappedPrimaryKeyFetchedProperties {
+} SingleEntityRelatedToManyMappedEntitiesUsingMappedPrimaryKeyFetchedProperties;
+
@class MappedEntity;
@@ -3,6 +3,17 @@
#import "_SingleEntityRelatedToManyMappedEntitiesUsingMappedPrimaryKey.h"
+const struct SingleEntityRelatedToManyMappedEntitiesUsingMappedPrimaryKeyAttributes SingleEntityRelatedToManyMappedEntitiesUsingMappedPrimaryKeyAttributes = {
+ .testPrimaryKey = @"testPrimaryKey",
+};
+
+const struct SingleEntityRelatedToManyMappedEntitiesUsingMappedPrimaryKeyRelationships SingleEntityRelatedToManyMappedEntitiesUsingMappedPrimaryKeyRelationships = {
+ .mappedEntities = @"mappedEntities",
+};
+
+const struct SingleEntityRelatedToManyMappedEntitiesUsingMappedPrimaryKeyFetchedProperties SingleEntityRelatedToManyMappedEntitiesUsingMappedPrimaryKeyFetchedProperties = {
+};
+
@implementation SingleEntityRelatedToManyMappedEntitiesUsingMappedPrimaryKeyID
@end
@@ -4,6 +4,17 @@
#import <CoreData/CoreData.h>
+extern const struct SingleEntityRelatedToMappedEntityUsingDefaultsAttributes {
+ NSString *singleEntityRelatedToMappedEntityUsingDefaultsID;
+} SingleEntityRelatedToMappedEntityUsingDefaultsAttributes;
+
+extern const struct SingleEntityRelatedToMappedEntityUsingDefaultsRelationships {
+ NSString *mappedEntity;
+} SingleEntityRelatedToMappedEntityUsingDefaultsRelationships;
+
+extern const struct SingleEntityRelatedToMappedEntityUsingDefaultsFetchedProperties {
+} SingleEntityRelatedToMappedEntityUsingDefaultsFetchedProperties;
+
@class MappedEntity;
@@ -3,6 +3,17 @@
#import "_SingleEntityRelatedToMappedEntityUsingDefaults.h"
+const struct SingleEntityRelatedToMappedEntityUsingDefaultsAttributes SingleEntityRelatedToMappedEntityUsingDefaultsAttributes = {
+ .singleEntityRelatedToMappedEntityUsingDefaultsID = @"singleEntityRelatedToMappedEntityUsingDefaultsID",
+};
+
+const struct SingleEntityRelatedToMappedEntityUsingDefaultsRelationships SingleEntityRelatedToMappedEntityUsingDefaultsRelationships = {
+ .mappedEntity = @"mappedEntity",
+};
+
+const struct SingleEntityRelatedToMappedEntityUsingDefaultsFetchedProperties SingleEntityRelatedToMappedEntityUsingDefaultsFetchedProperties = {
+};
+
@implementation SingleEntityRelatedToMappedEntityUsingDefaultsID
@end
@@ -4,6 +4,16 @@
#import <CoreData/CoreData.h>
+extern const struct SingleEntityRelatedToMappedEntityUsingMappedPrimaryKeyAttributes {
+} SingleEntityRelatedToMappedEntityUsingMappedPrimaryKeyAttributes;
+
+extern const struct SingleEntityRelatedToMappedEntityUsingMappedPrimaryKeyRelationships {
+ NSString *mappedEntity;
+} SingleEntityRelatedToMappedEntityUsingMappedPrimaryKeyRelationships;
+
+extern const struct SingleEntityRelatedToMappedEntityUsingMappedPrimaryKeyFetchedProperties {
+} SingleEntityRelatedToMappedEntityUsingMappedPrimaryKeyFetchedProperties;
+
@class MappedEntity;
@@ -3,6 +3,16 @@
#import "_SingleEntityRelatedToMappedEntityUsingMappedPrimaryKey.h"
+const struct SingleEntityRelatedToMappedEntityUsingMappedPrimaryKeyAttributes SingleEntityRelatedToMappedEntityUsingMappedPrimaryKeyAttributes = {
+};
+
+const struct SingleEntityRelatedToMappedEntityUsingMappedPrimaryKeyRelationships SingleEntityRelatedToMappedEntityUsingMappedPrimaryKeyRelationships = {
+ .mappedEntity = @"mappedEntity",
+};
+
+const struct SingleEntityRelatedToMappedEntityUsingMappedPrimaryKeyFetchedProperties SingleEntityRelatedToMappedEntityUsingMappedPrimaryKeyFetchedProperties = {
+};
+
@implementation SingleEntityRelatedToMappedEntityUsingMappedPrimaryKeyID
@end
@@ -4,6 +4,16 @@
#import <CoreData/CoreData.h>
+extern const struct SingleEntityRelatedToMappedEntityWithNestedMappedAttributesAttributes {
+} SingleEntityRelatedToMappedEntityWithNestedMappedAttributesAttributes;
+
+extern const struct SingleEntityRelatedToMappedEntityWithNestedMappedAttributesRelationships {
+ NSString *mappedEntity;
+} SingleEntityRelatedToMappedEntityWithNestedMappedAttributesRelationships;
+
+extern const struct SingleEntityRelatedToMappedEntityWithNestedMappedAttributesFetchedProperties {
+} SingleEntityRelatedToMappedEntityWithNestedMappedAttributesFetchedProperties;
+
@class MappedEntity;
@@ -3,6 +3,16 @@
#import "_SingleEntityRelatedToMappedEntityWithNestedMappedAttributes.h"
+const struct SingleEntityRelatedToMappedEntityWithNestedMappedAttributesAttributes SingleEntityRelatedToMappedEntityWithNestedMappedAttributesAttributes = {
+};
+
+const struct SingleEntityRelatedToMappedEntityWithNestedMappedAttributesRelationships SingleEntityRelatedToMappedEntityWithNestedMappedAttributesRelationships = {
+ .mappedEntity = @"mappedEntity",
+};
+
+const struct SingleEntityRelatedToMappedEntityWithNestedMappedAttributesFetchedProperties SingleEntityRelatedToMappedEntityWithNestedMappedAttributesFetchedProperties = {
+};
+
@implementation SingleEntityRelatedToMappedEntityWithNestedMappedAttributesID
@end
@@ -4,6 +4,17 @@
#import <CoreData/CoreData.h>
+extern const struct SingleEntityRelatedToMappedEntityWithSecondaryMappingsAttributes {
+ NSString *secondaryMappedAttribute;
+} SingleEntityRelatedToMappedEntityWithSecondaryMappingsAttributes;
+
+extern const struct SingleEntityRelatedToMappedEntityWithSecondaryMappingsRelationships {
+ NSString *mappedRelationship;
+} SingleEntityRelatedToMappedEntityWithSecondaryMappingsRelationships;
+
+extern const struct SingleEntityRelatedToMappedEntityWithSecondaryMappingsFetchedProperties {
+} SingleEntityRelatedToMappedEntityWithSecondaryMappingsFetchedProperties;
+
@class MappedEntity;
@@ -3,6 +3,17 @@
#import "_SingleEntityRelatedToMappedEntityWithSecondaryMappings.h"
+const struct SingleEntityRelatedToMappedEntityWithSecondaryMappingsAttributes SingleEntityRelatedToMappedEntityWithSecondaryMappingsAttributes = {
+ .secondaryMappedAttribute = @"secondaryMappedAttribute",
+};
+
+const struct SingleEntityRelatedToMappedEntityWithSecondaryMappingsRelationships SingleEntityRelatedToMappedEntityWithSecondaryMappingsRelationships = {
+ .mappedRelationship = @"mappedRelationship",
+};
+
+const struct SingleEntityRelatedToMappedEntityWithSecondaryMappingsFetchedProperties SingleEntityRelatedToMappedEntityWithSecondaryMappingsFetchedProperties = {
+};
+
@implementation SingleEntityRelatedToMappedEntityWithSecondaryMappingsID
@end
@@ -4,6 +4,29 @@
#import <CoreData/CoreData.h>
+extern const struct SingleEntityWithNoRelationshipsAttributes {
+ NSString *booleanTestAttribute;
+ NSString *colorTestAttribute;
+ NSString *dateTestAttribute;
+ NSString *dateWithCustomFormat;
+ NSString *decimalTestAttribute;
+ NSString *doubleTestAttribute;
+ NSString *floatTestAttribute;
+ NSString *int16TestAttribute;
+ NSString *int32TestAttribute;
+ NSString *int64TestAttribute;
+ NSString *mappedStringAttribute;
+ NSString *notInJsonAttribute;
+ NSString *nullTestAttribute;
+ NSString *stringTestAttribute;
+} SingleEntityWithNoRelationshipsAttributes;
+
+extern const struct SingleEntityWithNoRelationshipsRelationships {
+} SingleEntityWithNoRelationshipsRelationships;
+
+extern const struct SingleEntityWithNoRelationshipsFetchedProperties {
+} SingleEntityWithNoRelationshipsFetchedProperties;
+
@class UIColor;
@@ -3,6 +3,29 @@
#import "_SingleEntityWithNoRelationships.h"
+const struct SingleEntityWithNoRelationshipsAttributes SingleEntityWithNoRelationshipsAttributes = {
+ .booleanTestAttribute = @"booleanTestAttribute",
+ .colorTestAttribute = @"colorTestAttribute",
+ .dateTestAttribute = @"dateTestAttribute",
+ .dateWithCustomFormat = @"dateWithCustomFormat",
+ .decimalTestAttribute = @"decimalTestAttribute",
+ .doubleTestAttribute = @"doubleTestAttribute",
+ .floatTestAttribute = @"floatTestAttribute",
+ .int16TestAttribute = @"int16TestAttribute",
+ .int32TestAttribute = @"int32TestAttribute",
+ .int64TestAttribute = @"int64TestAttribute",
+ .mappedStringAttribute = @"mappedStringAttribute",
+ .notInJsonAttribute = @"notInJsonAttribute",
+ .nullTestAttribute = @"nullTestAttribute",
+ .stringTestAttribute = @"stringTestAttribute",
+};
+
+const struct SingleEntityWithNoRelationshipsRelationships SingleEntityWithNoRelationshipsRelationships = {
+};
+
+const struct SingleEntityWithNoRelationshipsFetchedProperties SingleEntityWithNoRelationshipsFetchedProperties = {
+};
+
@implementation SingleEntityWithNoRelationshipsID
@end
Oops, something went wrong.

0 comments on commit 07538d5

Please sign in to comment.