mirror of
https://github.com/modo-studio/SugarRecord.git
synced 2024-08-17 02:10:37 +03:00
Add tests again
This commit is contained in:
parent
f5f8672afb
commit
098910e1b6
@ -23,10 +23,30 @@
|
||||
23C453541D778CE000483DB4 /* Directory.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23C453441D778CE000483DB4 /* Directory.swift */; };
|
||||
23C453551D778CE000483DB4 /* Random.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23C453451D778CE000483DB4 /* Random.swift */; };
|
||||
23C453561D778CE000483DB4 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23C453471D778CE000483DB4 /* ViewController.swift */; };
|
||||
23C6F3A41D77945A0086ADC7 /* CoreData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23C6F37C1D77945A0086ADC7 /* CoreData.swift */; };
|
||||
23C6F3A51D77945A0086ADC7 /* Realm.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23C6F37D1D77945A0086ADC7 /* Realm.swift */; };
|
||||
23C6F3A61D77945A0086ADC7 /* Track+CoreDataProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23C6F3801D77945A0086ADC7 /* Track+CoreDataProperties.swift */; };
|
||||
23C6F3A71D77945A0086ADC7 /* Track.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23C6F3811D77945A0086ADC7 /* Track.swift */; };
|
||||
23C6F3A81D77945A0086ADC7 /* Issue.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23C6F3831D77945A0086ADC7 /* Issue.swift */; };
|
||||
23C6F3A91D77945A0086ADC7 /* Repository.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23C6F3841D77945A0086ADC7 /* Repository.swift */; };
|
||||
23C6F3AA1D77945A0086ADC7 /* DataModel.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 23C6F3861D77945A0086ADC7 /* DataModel.xcdatamodeld */; };
|
||||
23C6F3AB1D77945A0086ADC7 /* CoreDataChangeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23C6F38B1D77945A0086ADC7 /* CoreDataChangeTests.swift */; };
|
||||
23C6F3AC1D77945A0086ADC7 /* CoreDataObservableTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23C6F38C1D77945A0086ADC7 /* CoreDataObservableTests.swift */; };
|
||||
23C6F3AD1D77945A0086ADC7 /* ObjectModelTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23C6F38D1D77945A0086ADC7 /* ObjectModelTests.swift */; };
|
||||
23C6F3AE1D77945A0086ADC7 /* OptionsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23C6F38E1D77945A0086ADC7 /* OptionsTests.swift */; };
|
||||
23C6F3AF1D77945A0086ADC7 /* StoreTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23C6F38F1D77945A0086ADC7 /* StoreTests.swift */; };
|
||||
23C6F3B01D77945A0086ADC7 /* CoreDataDefaultStorageTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23C6F3911D77945A0086ADC7 /* CoreDataDefaultStorageTests.swift */; };
|
||||
23C6F3B11D77945A0086ADC7 /* RequestTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23C6F3941D77945A0086ADC7 /* RequestTests.swift */; };
|
||||
23C6F3B21D77945A0086ADC7 /* DirUtilsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23C6F3961D77945A0086ADC7 /* DirUtilsTests.swift */; };
|
||||
23C6F3B31D77945A0086ADC7 /* VersionControllerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23C6F3981D77945A0086ADC7 /* VersionControllerTests.swift */; };
|
||||
23C6F3B41D77945A0086ADC7 /* VersionProviderTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23C6F3991D77945A0086ADC7 /* VersionProviderTests.swift */; };
|
||||
23C6F3B61D77945A0086ADC7 /* RealmObservableTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23C6F39E1D77945A0086ADC7 /* RealmObservableTests.swift */; };
|
||||
23C6F3B71D77945A0086ADC7 /* RealmTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23C6F3A01D77945A0086ADC7 /* RealmTests.swift */; };
|
||||
23C6F3B81D77945A0086ADC7 /* ResultsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23C6F3A11D77945A0086ADC7 /* ResultsTests.swift */; };
|
||||
23C6F3B91D77945A0086ADC7 /* RealmDefaultStorageTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23C6F3A31D77945A0086ADC7 /* RealmDefaultStorageTests.swift */; };
|
||||
2EE798E2F553BBD04BAE12D3 /* Pods_Examples.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0F21E9D7346F4EF2BCA660DF /* Pods_Examples.framework */; };
|
||||
4F10AC81EEB556A8BB7850E6 /* Pods_iOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 14C934EDBEE5C24B6D0950F6 /* Pods_iOS.framework */; };
|
||||
6594DCC531FDDD58C51CEB6D /* Pods_tvOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BE945300D6480411717627AB /* Pods_tvOS.framework */; };
|
||||
CBD83E87FFC67C4152939935 /* Pods_Tests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D3A53C20C60D101DD37898E9 /* Pods_Tests.framework */; };
|
||||
F25791793138554144143D6F /* Pods_macOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3283D5C0DE48A9E554727B31 /* Pods_macOS.framework */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
@ -55,6 +75,27 @@
|
||||
23C453451D778CE000483DB4 /* Random.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Random.swift; sourceTree = "<group>"; };
|
||||
23C453471D778CE000483DB4 /* ViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
|
||||
23C453571D778D0C00483DB4 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
23C6F37C1D77945A0086ADC7 /* CoreData.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CoreData.swift; sourceTree = "<group>"; };
|
||||
23C6F37D1D77945A0086ADC7 /* Realm.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Realm.swift; sourceTree = "<group>"; };
|
||||
23C6F3801D77945A0086ADC7 /* Track+CoreDataProperties.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Track+CoreDataProperties.swift"; sourceTree = "<group>"; };
|
||||
23C6F3811D77945A0086ADC7 /* Track.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Track.swift; sourceTree = "<group>"; };
|
||||
23C6F3831D77945A0086ADC7 /* Issue.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Issue.swift; sourceTree = "<group>"; };
|
||||
23C6F3841D77945A0086ADC7 /* Repository.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Repository.swift; sourceTree = "<group>"; };
|
||||
23C6F3871D77945A0086ADC7 /* DataModel.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = DataModel.xcdatamodel; sourceTree = "<group>"; };
|
||||
23C6F38B1D77945A0086ADC7 /* CoreDataChangeTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CoreDataChangeTests.swift; sourceTree = "<group>"; };
|
||||
23C6F38C1D77945A0086ADC7 /* CoreDataObservableTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CoreDataObservableTests.swift; sourceTree = "<group>"; };
|
||||
23C6F38D1D77945A0086ADC7 /* ObjectModelTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ObjectModelTests.swift; sourceTree = "<group>"; };
|
||||
23C6F38E1D77945A0086ADC7 /* OptionsTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OptionsTests.swift; sourceTree = "<group>"; };
|
||||
23C6F38F1D77945A0086ADC7 /* StoreTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StoreTests.swift; sourceTree = "<group>"; };
|
||||
23C6F3911D77945A0086ADC7 /* CoreDataDefaultStorageTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CoreDataDefaultStorageTests.swift; sourceTree = "<group>"; };
|
||||
23C6F3941D77945A0086ADC7 /* RequestTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RequestTests.swift; sourceTree = "<group>"; };
|
||||
23C6F3961D77945A0086ADC7 /* DirUtilsTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DirUtilsTests.swift; sourceTree = "<group>"; };
|
||||
23C6F3981D77945A0086ADC7 /* VersionControllerTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = VersionControllerTests.swift; sourceTree = "<group>"; };
|
||||
23C6F3991D77945A0086ADC7 /* VersionProviderTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = VersionProviderTests.swift; sourceTree = "<group>"; };
|
||||
23C6F39E1D77945A0086ADC7 /* RealmObservableTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RealmObservableTests.swift; sourceTree = "<group>"; };
|
||||
23C6F3A01D77945A0086ADC7 /* RealmTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RealmTests.swift; sourceTree = "<group>"; };
|
||||
23C6F3A11D77945A0086ADC7 /* ResultsTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ResultsTests.swift; sourceTree = "<group>"; };
|
||||
23C6F3A31D77945A0086ADC7 /* RealmDefaultStorageTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RealmDefaultStorageTests.swift; sourceTree = "<group>"; };
|
||||
23EA8C981D6E1550008333A4 /* iOS.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = iOS.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
26D23356944FDBD309693612 /* Pods-tvOS.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-tvOS.release.xcconfig"; path = "Pods/Target Support Files/Pods-tvOS/Pods-tvOS.release.xcconfig"; sourceTree = "<group>"; };
|
||||
2B09DC50E028F3BAB67509AD /* Pods-tvOS.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-tvOS.debug.xcconfig"; path = "Pods/Target Support Files/Pods-tvOS/Pods-tvOS.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
@ -100,7 +141,6 @@
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
CBD83E87FFC67C4152939935 /* Pods_Tests.framework in Frameworks */,
|
||||
4F10AC81EEB556A8BB7850E6 /* Pods_iOS.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
@ -129,6 +169,10 @@
|
||||
23C4530E1D77899A00483DB4 /* iOS */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
23C6F37B1D77945A0086ADC7 /* Helpers */,
|
||||
23C6F37E1D77945A0086ADC7 /* Models */,
|
||||
23C6F3851D77945A0086ADC7 /* Resources */,
|
||||
23C6F3881D77945A0086ADC7 /* Source */,
|
||||
23C4530F1D77899A00483DB4 /* Info.plist */,
|
||||
);
|
||||
path = iOS;
|
||||
@ -275,6 +319,163 @@
|
||||
path = Main;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
23C6F37B1D77945A0086ADC7 /* Helpers */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
23C6F37C1D77945A0086ADC7 /* CoreData.swift */,
|
||||
23C6F37D1D77945A0086ADC7 /* Realm.swift */,
|
||||
);
|
||||
name = Helpers;
|
||||
path = ../../Tests/Helpers;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
23C6F37E1D77945A0086ADC7 /* Models */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
23C6F37F1D77945A0086ADC7 /* CoreData */,
|
||||
23C6F3821D77945A0086ADC7 /* Realm */,
|
||||
);
|
||||
name = Models;
|
||||
path = ../../Tests/Models;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
23C6F37F1D77945A0086ADC7 /* CoreData */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
23C6F3801D77945A0086ADC7 /* Track+CoreDataProperties.swift */,
|
||||
23C6F3811D77945A0086ADC7 /* Track.swift */,
|
||||
);
|
||||
path = CoreData;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
23C6F3821D77945A0086ADC7 /* Realm */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
23C6F3831D77945A0086ADC7 /* Issue.swift */,
|
||||
23C6F3841D77945A0086ADC7 /* Repository.swift */,
|
||||
);
|
||||
path = Realm;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
23C6F3851D77945A0086ADC7 /* Resources */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
23C6F3861D77945A0086ADC7 /* DataModel.xcdatamodeld */,
|
||||
);
|
||||
name = Resources;
|
||||
path = ../../Tests/Resources;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
23C6F3881D77945A0086ADC7 /* Source */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
23C6F3891D77945A0086ADC7 /* CoreData */,
|
||||
23C6F3921D77945A0086ADC7 /* Foundation */,
|
||||
23C6F39C1D77945A0086ADC7 /* Realm */,
|
||||
);
|
||||
name = Source;
|
||||
path = ../../Tests/Source;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
23C6F3891D77945A0086ADC7 /* CoreData */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
23C6F38A1D77945A0086ADC7 /* Entities */,
|
||||
23C6F3901D77945A0086ADC7 /* Storage */,
|
||||
);
|
||||
path = CoreData;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
23C6F38A1D77945A0086ADC7 /* Entities */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
23C6F38B1D77945A0086ADC7 /* CoreDataChangeTests.swift */,
|
||||
23C6F38C1D77945A0086ADC7 /* CoreDataObservableTests.swift */,
|
||||
23C6F38D1D77945A0086ADC7 /* ObjectModelTests.swift */,
|
||||
23C6F38E1D77945A0086ADC7 /* OptionsTests.swift */,
|
||||
23C6F38F1D77945A0086ADC7 /* StoreTests.swift */,
|
||||
);
|
||||
path = Entities;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
23C6F3901D77945A0086ADC7 /* Storage */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
23C6F3911D77945A0086ADC7 /* CoreDataDefaultStorageTests.swift */,
|
||||
);
|
||||
path = Storage;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
23C6F3921D77945A0086ADC7 /* Foundation */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
23C6F3931D77945A0086ADC7 /* Entities */,
|
||||
23C6F3951D77945A0086ADC7 /* Utils */,
|
||||
23C6F3971D77945A0086ADC7 /* Version */,
|
||||
);
|
||||
path = Foundation;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
23C6F3931D77945A0086ADC7 /* Entities */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
23C6F3941D77945A0086ADC7 /* RequestTests.swift */,
|
||||
);
|
||||
path = Entities;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
23C6F3951D77945A0086ADC7 /* Utils */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
23C6F3961D77945A0086ADC7 /* DirUtilsTests.swift */,
|
||||
);
|
||||
path = Utils;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
23C6F3971D77945A0086ADC7 /* Version */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
23C6F3981D77945A0086ADC7 /* VersionControllerTests.swift */,
|
||||
23C6F3991D77945A0086ADC7 /* VersionProviderTests.swift */,
|
||||
);
|
||||
path = Version;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
23C6F39C1D77945A0086ADC7 /* Realm */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
23C6F39D1D77945A0086ADC7 /* Entities */,
|
||||
23C6F39F1D77945A0086ADC7 /* Extensions */,
|
||||
23C6F3A21D77945A0086ADC7 /* Storages */,
|
||||
);
|
||||
path = Realm;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
23C6F39D1D77945A0086ADC7 /* Entities */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
23C6F39E1D77945A0086ADC7 /* RealmObservableTests.swift */,
|
||||
);
|
||||
path = Entities;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
23C6F39F1D77945A0086ADC7 /* Extensions */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
23C6F3A01D77945A0086ADC7 /* RealmTests.swift */,
|
||||
23C6F3A11D77945A0086ADC7 /* ResultsTests.swift */,
|
||||
);
|
||||
path = Extensions;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
23C6F3A21D77945A0086ADC7 /* Storages */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
23C6F3A31D77945A0086ADC7 /* RealmDefaultStorageTests.swift */,
|
||||
);
|
||||
path = Storages;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
23D592541C2834DC00441B41 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@ -713,6 +914,27 @@
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
23C6F3AC1D77945A0086ADC7 /* CoreDataObservableTests.swift in Sources */,
|
||||
23C6F3B11D77945A0086ADC7 /* RequestTests.swift in Sources */,
|
||||
23C6F3AB1D77945A0086ADC7 /* CoreDataChangeTests.swift in Sources */,
|
||||
23C6F3A81D77945A0086ADC7 /* Issue.swift in Sources */,
|
||||
23C6F3B31D77945A0086ADC7 /* VersionControllerTests.swift in Sources */,
|
||||
23C6F3A41D77945A0086ADC7 /* CoreData.swift in Sources */,
|
||||
23C6F3AD1D77945A0086ADC7 /* ObjectModelTests.swift in Sources */,
|
||||
23C6F3B01D77945A0086ADC7 /* CoreDataDefaultStorageTests.swift in Sources */,
|
||||
23C6F3A51D77945A0086ADC7 /* Realm.swift in Sources */,
|
||||
23C6F3AA1D77945A0086ADC7 /* DataModel.xcdatamodeld in Sources */,
|
||||
23C6F3B71D77945A0086ADC7 /* RealmTests.swift in Sources */,
|
||||
23C6F3A61D77945A0086ADC7 /* Track+CoreDataProperties.swift in Sources */,
|
||||
23C6F3B21D77945A0086ADC7 /* DirUtilsTests.swift in Sources */,
|
||||
23C6F3B41D77945A0086ADC7 /* VersionProviderTests.swift in Sources */,
|
||||
23C6F3B91D77945A0086ADC7 /* RealmDefaultStorageTests.swift in Sources */,
|
||||
23C6F3AE1D77945A0086ADC7 /* OptionsTests.swift in Sources */,
|
||||
23C6F3B81D77945A0086ADC7 /* ResultsTests.swift in Sources */,
|
||||
23C6F3A71D77945A0086ADC7 /* Track.swift in Sources */,
|
||||
23C6F3A91D77945A0086ADC7 /* Repository.swift in Sources */,
|
||||
23C6F3AF1D77945A0086ADC7 /* StoreTests.swift in Sources */,
|
||||
23C6F3B61D77945A0086ADC7 /* RealmObservableTests.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@ -979,6 +1201,16 @@
|
||||
sourceTree = "<group>";
|
||||
versionGroupType = wrapper.xcdatamodel;
|
||||
};
|
||||
23C6F3861D77945A0086ADC7 /* DataModel.xcdatamodeld */ = {
|
||||
isa = XCVersionGroup;
|
||||
children = (
|
||||
23C6F3871D77945A0086ADC7 /* DataModel.xcdatamodel */,
|
||||
);
|
||||
currentVersion = 23C6F3871D77945A0086ADC7 /* DataModel.xcdatamodel */;
|
||||
path = DataModel.xcdatamodeld;
|
||||
sourceTree = "<group>";
|
||||
versionGroupType = wrapper.xcdatamodel;
|
||||
};
|
||||
/* End XCVersionGroup section */
|
||||
};
|
||||
rootObject = 23D592551C2834DC00441B41 /* Project object */;
|
||||
|
@ -14,7 +14,7 @@
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "23D5925C1C2834DC00441B41"
|
||||
BlueprintIdentifier = "23C453141D7789A900483DB4"
|
||||
BuildableName = "Examples.app"
|
||||
BlueprintName = "Examples"
|
||||
ReferencedContainer = "container:Examples.xcodeproj">
|
||||
@ -28,21 +28,11 @@
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
<TestableReference
|
||||
skipped = "NO">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "23EA8C971D6E1550008333A4"
|
||||
BuildableName = "iOS.xctest"
|
||||
BlueprintName = "iOS"
|
||||
ReferencedContainer = "container:Examples.xcodeproj">
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
</Testables>
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "23D5925C1C2834DC00441B41"
|
||||
BlueprintIdentifier = "23C453141D7789A900483DB4"
|
||||
BuildableName = "Examples.app"
|
||||
BlueprintName = "Examples"
|
||||
ReferencedContainer = "container:Examples.xcodeproj">
|
||||
@ -65,7 +55,7 @@
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "23D5925C1C2834DC00441B41"
|
||||
BlueprintIdentifier = "23C453141D7789A900483DB4"
|
||||
BuildableName = "Examples.app"
|
||||
BlueprintName = "Examples"
|
||||
ReferencedContainer = "container:Examples.xcodeproj">
|
||||
@ -84,7 +74,7 @@
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "23D5925C1C2834DC00441B41"
|
||||
BlueprintIdentifier = "23C453141D7789A900483DB4"
|
||||
BuildableName = "Examples.app"
|
||||
BlueprintName = "Examples"
|
||||
ReferencedContainer = "container:Examples.xcodeproj">
|
||||
|
@ -0,0 +1,56 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0730"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
<TestableReference
|
||||
skipped = "NO">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "23EA8C971D6E1550008333A4"
|
||||
BuildableName = "iOS.xctest"
|
||||
BlueprintName = "iOS"
|
||||
ReferencedContainer = "container:Examples.xcodeproj">
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
</Testables>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
@ -15,6 +15,8 @@ target 'iOS' do
|
||||
pod 'SugarRecord/Realm', :path => "../"
|
||||
pod "Quick"
|
||||
pod "Nimble"
|
||||
pod "OHHTTPStubs"
|
||||
pod 'OHHTTPStubs/Swift'
|
||||
end
|
||||
|
||||
target 'macOS' do
|
||||
|
@ -1,5 +1,20 @@
|
||||
PODS:
|
||||
- Nimble (4.1.0)
|
||||
- OHHTTPStubs (5.2.0):
|
||||
- OHHTTPStubs/Default (= 5.2.0)
|
||||
- OHHTTPStubs/Core (5.2.0)
|
||||
- OHHTTPStubs/Default (5.2.0):
|
||||
- OHHTTPStubs/Core
|
||||
- OHHTTPStubs/JSON
|
||||
- OHHTTPStubs/NSURLSession
|
||||
- OHHTTPStubs/OHPathHelpers
|
||||
- OHHTTPStubs/JSON (5.2.0):
|
||||
- OHHTTPStubs/Core
|
||||
- OHHTTPStubs/NSURLSession (5.2.0):
|
||||
- OHHTTPStubs/Core
|
||||
- OHHTTPStubs/OHPathHelpers (5.2.0)
|
||||
- OHHTTPStubs/Swift (5.2.0):
|
||||
- OHHTTPStubs/Core
|
||||
- Quick (0.9.3)
|
||||
- Realm (1.0.2):
|
||||
- Realm/Headers (= 1.0.2)
|
||||
@ -8,20 +23,22 @@ PODS:
|
||||
- Realm (= 1.0.2)
|
||||
- Result (2.1.3)
|
||||
- SnapKit (0.22.0)
|
||||
- SugarRecord (2.2.9):
|
||||
- SugarRecord/CoreData (= 2.2.9)
|
||||
- SugarRecord/CoreData+iCloud (= 2.2.9)
|
||||
- SugarRecord/Realm (= 2.2.9)
|
||||
- SugarRecord/CoreData (2.2.9):
|
||||
- SugarRecord (2.3.0):
|
||||
- SugarRecord/CoreData (= 2.3.0)
|
||||
- SugarRecord/CoreData+iCloud (= 2.3.0)
|
||||
- SugarRecord/Realm (= 2.3.0)
|
||||
- SugarRecord/CoreData (2.3.0):
|
||||
- Result (~> 2.0)
|
||||
- SugarRecord/CoreData+iCloud (2.2.9):
|
||||
- SugarRecord/CoreData+iCloud (2.3.0):
|
||||
- Result (~> 2.0)
|
||||
- SugarRecord/Realm (2.2.9):
|
||||
- SugarRecord/Realm (2.3.0):
|
||||
- RealmSwift (~> 1.0.2)
|
||||
- Result (~> 2.0)
|
||||
|
||||
DEPENDENCIES:
|
||||
- Nimble
|
||||
- OHHTTPStubs
|
||||
- OHHTTPStubs/Swift
|
||||
- Quick
|
||||
- SnapKit
|
||||
- SugarRecord (from `../`)
|
||||
@ -35,13 +52,14 @@ EXTERNAL SOURCES:
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
Nimble: 97a0a4cae5124c117115634b2d055d8c97d0af19
|
||||
OHHTTPStubs: 29ae105797c3410112d10b217c8b7a55aab616b2
|
||||
Quick: 13a2a2b19a5d8e3ed4fd0c36ee46597fd77ebf71
|
||||
Realm: 9d5c46a4d7d27958530a8dfc58f63a99e5c2cba3
|
||||
RealmSwift: 82f3ac5e24530143dddfde2033acc0d308f27d96
|
||||
Result: 18e1a7597fbcca5923c565b40a25a98afafdee02
|
||||
SnapKit: 0dd2fd157330f1ea11fd84da13e6be8a7a22bae0
|
||||
SugarRecord: b08fa012f7d4b0ccda02756467c03b0dfd403217
|
||||
SugarRecord: 4e137840568085f9b6d06983b85b95fc508f26b2
|
||||
|
||||
PODFILE CHECKSUM: a1045c82a960fbaad95f018ee48d867cd80268f0
|
||||
PODFILE CHECKSUM: 84b458db6d0a6ac2d0ccc07cf47227ad4bf8aa0a
|
||||
|
||||
COCOAPODS: 1.0.1
|
||||
|
@ -1,17 +1,17 @@
|
||||
{
|
||||
"name": "SugarRecord",
|
||||
"version": "2.2.9",
|
||||
"summary": "CoreData wrapper written on Swift",
|
||||
"homepage": "https://github.com/pepibumur/SugarRecord",
|
||||
"version": "2.3.0",
|
||||
"summary": "CoreData & Realmwrapper written on Swift",
|
||||
"homepage": "https://github.com/carambalabs/SugarRecord",
|
||||
"license": "MIT",
|
||||
"authors": {
|
||||
"Pedro": "pedro@gitdo.io"
|
||||
"Pedro": "pepibumur@gmail.com"
|
||||
},
|
||||
"source": {
|
||||
"git": "https://github.com/pepibumur/SugarRecord.git",
|
||||
"tag": "2.2.9"
|
||||
"git": "https://github.com/carambalabs/SugarRecord.git",
|
||||
"tag": "2.3.0"
|
||||
},
|
||||
"social_media_url": "https://twitter.com/pepibumur",
|
||||
"social_media_url": "https://twitter.com/carambalabs",
|
||||
"requires_arc": true,
|
||||
"platforms": {
|
||||
"ios": "8.0",
|
||||
|
36
Examples/Pods/Manifest.lock
generated
36
Examples/Pods/Manifest.lock
generated
@ -1,5 +1,20 @@
|
||||
PODS:
|
||||
- Nimble (4.1.0)
|
||||
- OHHTTPStubs (5.2.0):
|
||||
- OHHTTPStubs/Default (= 5.2.0)
|
||||
- OHHTTPStubs/Core (5.2.0)
|
||||
- OHHTTPStubs/Default (5.2.0):
|
||||
- OHHTTPStubs/Core
|
||||
- OHHTTPStubs/JSON
|
||||
- OHHTTPStubs/NSURLSession
|
||||
- OHHTTPStubs/OHPathHelpers
|
||||
- OHHTTPStubs/JSON (5.2.0):
|
||||
- OHHTTPStubs/Core
|
||||
- OHHTTPStubs/NSURLSession (5.2.0):
|
||||
- OHHTTPStubs/Core
|
||||
- OHHTTPStubs/OHPathHelpers (5.2.0)
|
||||
- OHHTTPStubs/Swift (5.2.0):
|
||||
- OHHTTPStubs/Core
|
||||
- Quick (0.9.3)
|
||||
- Realm (1.0.2):
|
||||
- Realm/Headers (= 1.0.2)
|
||||
@ -8,20 +23,22 @@ PODS:
|
||||
- Realm (= 1.0.2)
|
||||
- Result (2.1.3)
|
||||
- SnapKit (0.22.0)
|
||||
- SugarRecord (2.2.9):
|
||||
- SugarRecord/CoreData (= 2.2.9)
|
||||
- SugarRecord/CoreData+iCloud (= 2.2.9)
|
||||
- SugarRecord/Realm (= 2.2.9)
|
||||
- SugarRecord/CoreData (2.2.9):
|
||||
- SugarRecord (2.3.0):
|
||||
- SugarRecord/CoreData (= 2.3.0)
|
||||
- SugarRecord/CoreData+iCloud (= 2.3.0)
|
||||
- SugarRecord/Realm (= 2.3.0)
|
||||
- SugarRecord/CoreData (2.3.0):
|
||||
- Result (~> 2.0)
|
||||
- SugarRecord/CoreData+iCloud (2.2.9):
|
||||
- SugarRecord/CoreData+iCloud (2.3.0):
|
||||
- Result (~> 2.0)
|
||||
- SugarRecord/Realm (2.2.9):
|
||||
- SugarRecord/Realm (2.3.0):
|
||||
- RealmSwift (~> 1.0.2)
|
||||
- Result (~> 2.0)
|
||||
|
||||
DEPENDENCIES:
|
||||
- Nimble
|
||||
- OHHTTPStubs
|
||||
- OHHTTPStubs/Swift
|
||||
- Quick
|
||||
- SnapKit
|
||||
- SugarRecord (from `../`)
|
||||
@ -35,13 +52,14 @@ EXTERNAL SOURCES:
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
Nimble: 97a0a4cae5124c117115634b2d055d8c97d0af19
|
||||
OHHTTPStubs: 29ae105797c3410112d10b217c8b7a55aab616b2
|
||||
Quick: 13a2a2b19a5d8e3ed4fd0c36ee46597fd77ebf71
|
||||
Realm: 9d5c46a4d7d27958530a8dfc58f63a99e5c2cba3
|
||||
RealmSwift: 82f3ac5e24530143dddfde2033acc0d308f27d96
|
||||
Result: 18e1a7597fbcca5923c565b40a25a98afafdee02
|
||||
SnapKit: 0dd2fd157330f1ea11fd84da13e6be8a7a22bae0
|
||||
SugarRecord: b08fa012f7d4b0ccda02756467c03b0dfd403217
|
||||
SugarRecord: 4e137840568085f9b6d06983b85b95fc508f26b2
|
||||
|
||||
PODFILE CHECKSUM: a1045c82a960fbaad95f018ee48d867cd80268f0
|
||||
PODFILE CHECKSUM: 84b458db6d0a6ac2d0ccc07cf47227ad4bf8aa0a
|
||||
|
||||
COCOAPODS: 1.0.1
|
||||
|
3006
Examples/Pods/Pods.xcodeproj/project.pbxproj
generated
3006
Examples/Pods/Pods.xcodeproj/project.pbxproj
generated
File diff suppressed because it is too large
Load Diff
12
Tests/Helpers/CoreData.swift
Executable file
12
Tests/Helpers/CoreData.swift
Executable file
@ -0,0 +1,12 @@
|
||||
import Foundation
|
||||
import CoreData
|
||||
|
||||
@testable import SugarRecord
|
||||
|
||||
func testCoreData() -> CoreDataDefaultStorage {
|
||||
let store = CoreData.Store.Named("testing")
|
||||
let bundle = NSBundle(forClass: CoreDataDefaultStorageTests.classForCoder())
|
||||
let model = CoreData.ObjectModel.Merged([bundle])
|
||||
let defaultStorage = try! CoreDataDefaultStorage(store: store, model: model)
|
||||
return defaultStorage
|
||||
}
|
6
Tests/Helpers/Realm.swift
Executable file
6
Tests/Helpers/Realm.swift
Executable file
@ -0,0 +1,6 @@
|
||||
import Foundation
|
||||
import RealmSwift
|
||||
|
||||
func testRealm() -> Realm {
|
||||
return try! Realm(configuration: Realm.Configuration(inMemoryIdentifier: "TestRealm"))
|
||||
}
|
9
Tests/Models/CoreData/Track+CoreDataProperties.swift
Executable file
9
Tests/Models/CoreData/Track+CoreDataProperties.swift
Executable file
@ -0,0 +1,9 @@
|
||||
import Foundation
|
||||
import CoreData
|
||||
|
||||
extension Track {
|
||||
|
||||
@NSManaged var name: String?
|
||||
@NSManaged var artist: String?
|
||||
|
||||
}
|
9
Tests/Models/CoreData/Track.swift
Executable file
9
Tests/Models/CoreData/Track.swift
Executable file
@ -0,0 +1,9 @@
|
||||
import Foundation
|
||||
import CoreData
|
||||
|
||||
|
||||
class Track: NSManagedObject {
|
||||
|
||||
// Insert code here to add functionality to your managed object subclass
|
||||
|
||||
}
|
25
Tests/Models/Realm/Issue.swift
Executable file
25
Tests/Models/Realm/Issue.swift
Executable file
@ -0,0 +1,25 @@
|
||||
import Foundation
|
||||
import RealmSwift
|
||||
|
||||
@testable import SugarRecord
|
||||
|
||||
class Issue: Object {
|
||||
|
||||
// MARK: - Attributes
|
||||
|
||||
dynamic var name: String = ""
|
||||
dynamic var closed: Bool = false
|
||||
dynamic var id: String = ""
|
||||
|
||||
|
||||
// MARK: - Object
|
||||
|
||||
internal override class func primaryKey() -> String? {
|
||||
return "id"
|
||||
}
|
||||
|
||||
|
||||
// MARK: - Relationships
|
||||
|
||||
dynamic var repository: Repository?
|
||||
}
|
18
Tests/Models/Realm/Repository.swift
Executable file
18
Tests/Models/Realm/Repository.swift
Executable file
@ -0,0 +1,18 @@
|
||||
import Foundation
|
||||
import RealmSwift
|
||||
|
||||
@testable import SugarRecord
|
||||
|
||||
class Repository: Object {
|
||||
|
||||
// MARK: - Attributes
|
||||
|
||||
dynamic var name: String = ""
|
||||
dynamic var organization: String = ""
|
||||
|
||||
|
||||
// MARK: - Relationships
|
||||
|
||||
let issues = LinkingObjects(fromType: Issue.self, property: "repository")
|
||||
|
||||
}
|
10
Tests/Resources/DataModel.xcdatamodeld/DataModel.xcdatamodel/contents
Executable file
10
Tests/Resources/DataModel.xcdatamodeld/DataModel.xcdatamodel/contents
Executable file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<model userDefinedModelVersionIdentifier="" type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="9057" systemVersion="14F1021" minimumToolsVersion="Xcode 7.0">
|
||||
<entity name="Track" representedClassName=".Track" syncable="YES">
|
||||
<attribute name="artist" optional="YES" attributeType="String" syncable="YES"/>
|
||||
<attribute name="name" optional="YES" attributeType="String" syncable="YES"/>
|
||||
</entity>
|
||||
<elements>
|
||||
<element name="Track" positionX="-63" positionY="-18" width="128" height="75"/>
|
||||
</elements>
|
||||
</model>
|
128
Tests/Source/CoreData/Entities/CoreDataChangeTests.swift
Executable file
128
Tests/Source/CoreData/Entities/CoreDataChangeTests.swift
Executable file
@ -0,0 +1,128 @@
|
||||
import Foundation
|
||||
import Quick
|
||||
import Nimble
|
||||
|
||||
@testable import SugarRecord
|
||||
|
||||
class CoreDataChangeTests: QuickSpec {
|
||||
|
||||
override func spec() {
|
||||
|
||||
context("Insert") {
|
||||
var change: CoreDataChange<String>!
|
||||
|
||||
beforeSuite {
|
||||
change = .Insert(0, "insert")
|
||||
}
|
||||
|
||||
describe("-object") {
|
||||
it("should return the correct object") {
|
||||
expect(change.object()) == "insert"
|
||||
}
|
||||
}
|
||||
|
||||
describe("-isDeletion") {
|
||||
it("should return false") {
|
||||
expect(change.isDeletion()) == false
|
||||
}
|
||||
}
|
||||
|
||||
describe("-isUpdate") {
|
||||
it("should return false") {
|
||||
expect(change.isUpdate()) == false
|
||||
}
|
||||
}
|
||||
|
||||
describe("-isInsertion") {
|
||||
it("should return true") {
|
||||
expect(change.isInsertion()) == true
|
||||
}
|
||||
}
|
||||
|
||||
describe("-index") {
|
||||
it("should return the correct index") {
|
||||
expect(change.index()) == 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
context("Update") {
|
||||
var change: CoreDataChange<String>!
|
||||
|
||||
beforeSuite {
|
||||
change = .Update(1, "update")
|
||||
}
|
||||
|
||||
describe("-object") {
|
||||
it("should return the correct object") {
|
||||
expect(change.object()) == "update"
|
||||
}
|
||||
}
|
||||
|
||||
describe("-isDeletion") {
|
||||
it("should return false") {
|
||||
expect(change.isDeletion()) == false
|
||||
}
|
||||
}
|
||||
|
||||
describe("-isUpdate") {
|
||||
it("should return true") {
|
||||
expect(change.isUpdate()) == true
|
||||
}
|
||||
}
|
||||
|
||||
describe("-isInsertion") {
|
||||
it("should return false") {
|
||||
expect(change.isInsertion()) == false
|
||||
}
|
||||
}
|
||||
|
||||
describe("-index") {
|
||||
it("should return the correct index") {
|
||||
expect(change.index()) == 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
context("Delete") {
|
||||
|
||||
var change: CoreDataChange<String>!
|
||||
|
||||
beforeSuite {
|
||||
change = .Delete(3, "delete")
|
||||
}
|
||||
|
||||
describe("-object") {
|
||||
it("should return the correct object") {
|
||||
expect(change.object()) == "delete"
|
||||
}
|
||||
}
|
||||
|
||||
describe("-isDeletion") {
|
||||
it("should return true") {
|
||||
expect(change.isDeletion()) == true
|
||||
}
|
||||
}
|
||||
|
||||
describe("-isUpdate") {
|
||||
it("should return false") {
|
||||
expect(change.isUpdate()) == false
|
||||
}
|
||||
}
|
||||
|
||||
describe("-isInsertion") {
|
||||
it("should return false") {
|
||||
expect(change.isInsertion()) == false
|
||||
}
|
||||
}
|
||||
|
||||
describe("-index") {
|
||||
it("should return the correct index") {
|
||||
expect(change.index()) == 3
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
84
Tests/Source/CoreData/Entities/CoreDataObservableTests.swift
Executable file
84
Tests/Source/CoreData/Entities/CoreDataObservableTests.swift
Executable file
@ -0,0 +1,84 @@
|
||||
import Foundation
|
||||
import Quick
|
||||
import Nimble
|
||||
import CoreData
|
||||
|
||||
@testable import SugarRecord
|
||||
|
||||
class CoreDataObservableTests: QuickSpec {
|
||||
|
||||
override func spec() {
|
||||
|
||||
var request: Request<Track>!
|
||||
var subject: CoreDataObservable<Track>!
|
||||
var storage: CoreDataDefaultStorage!
|
||||
|
||||
beforeEach {
|
||||
let store: CoreData.Store = CoreData.Store.Named("test")
|
||||
let bundle = NSBundle(forClass: self.classForCoder)
|
||||
let model = CoreData.ObjectModel.Merged([bundle])
|
||||
storage = try! CoreDataDefaultStorage(store: store, model: model)
|
||||
_ = try? storage.removeStore()
|
||||
request = Request<Track>().sortedWith("name", ascending: true)
|
||||
let context: NSManagedObjectContext = storage.mainContext as! NSManagedObjectContext
|
||||
subject = CoreDataObservable(request: request, context: context)
|
||||
context.performBlock({
|
||||
let track: Track = try! context.create()
|
||||
track.name = "test"
|
||||
track.artist = "pedro"
|
||||
try! context.save()
|
||||
})
|
||||
}
|
||||
|
||||
afterEach {
|
||||
_ = try? storage.removeStore()
|
||||
}
|
||||
|
||||
describe("-observe:") {
|
||||
it("should report the initial state") {
|
||||
waitUntil(action: { (done) in
|
||||
subject.observe({ (change) in
|
||||
switch change {
|
||||
case .Initial(let values):
|
||||
expect(values.first?.name) == "test"
|
||||
expect(values.first?.artist) == "pedro"
|
||||
done()
|
||||
default:
|
||||
break
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
it("should report updates") {
|
||||
waitUntil(action: { (done) in
|
||||
subject.observe({ (change) in
|
||||
switch change {
|
||||
case .Update(_, let insertions, _):
|
||||
expect(insertions[0].element.name) == "test2"
|
||||
expect(insertions[0].element.artist) == "pedro"
|
||||
done()
|
||||
default:
|
||||
break
|
||||
}
|
||||
})
|
||||
let context: NSManagedObjectContext = storage.mainContext as! NSManagedObjectContext
|
||||
context.performBlockAndWait {
|
||||
let track: Track = try! context.create()
|
||||
track.name = "test2"
|
||||
track.artist = "pedro"
|
||||
try! context.save()
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
describe("-dispose") {
|
||||
it("should unlink the NSFetchedResultsController from the observable") {
|
||||
subject.dispose()
|
||||
expect(subject.fetchedResultsController.delegate).to(beNil())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
41
Tests/Source/CoreData/Entities/ObjectModelTests.swift
Executable file
41
Tests/Source/CoreData/Entities/ObjectModelTests.swift
Executable file
@ -0,0 +1,41 @@
|
||||
import Foundation
|
||||
import Nimble
|
||||
import Quick
|
||||
import CoreData
|
||||
|
||||
@testable import SugarRecord
|
||||
|
||||
class ObjectModelTests: QuickSpec {
|
||||
|
||||
override func spec() {
|
||||
|
||||
describe("data model generation") { () -> Void in
|
||||
|
||||
context("merged", {
|
||||
it("should take the provided bundle data model", closure: { () -> () in
|
||||
let bundle = NSBundle(forClass: self.classForCoder)
|
||||
expect(CoreData.ObjectModel.Merged([bundle]).model()).toNot(beNil())
|
||||
})
|
||||
it("should return nil managed object model if no bundle is passed", closure: {
|
||||
expect(CoreData.ObjectModel.Merged(nil).model()?.entities.count) == 0
|
||||
})
|
||||
})
|
||||
|
||||
context("named", {
|
||||
it("should return the object model", closure: {
|
||||
expect(CoreData.ObjectModel.Named("DataModel", NSBundle(forClass: self.classForCoder)).model()?.entities.count) == 1
|
||||
})
|
||||
})
|
||||
|
||||
context("url", { () -> Void in
|
||||
it("should return an object model if the url is valid") {
|
||||
let url = NSBundle(forClass: self.classForCoder).URLForResource("DataModel", withExtension: "momd")
|
||||
expect(CoreData.ObjectModel.URL(url!).model()?.entities.count) == 1
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
34
Tests/Source/CoreData/Entities/OptionsTests.swift
Executable file
34
Tests/Source/CoreData/Entities/OptionsTests.swift
Executable file
@ -0,0 +1,34 @@
|
||||
import Foundation
|
||||
import Quick
|
||||
import Nimble
|
||||
import CoreData
|
||||
|
||||
@testable import SugarRecord
|
||||
|
||||
class OptionsTests: QuickSpec {
|
||||
|
||||
override func spec() {
|
||||
|
||||
describe("options dictionary content") {
|
||||
|
||||
it("should return the right data for default options") {
|
||||
let options = CoreData.Options.Default.dict()
|
||||
let sqliteOptions = options[NSSQLitePragmasOption] as! [String: String]
|
||||
expect(sqliteOptions["journal_mode"]) == "DELETE"
|
||||
expect(options[NSMigratePersistentStoresAutomaticallyOption] as? NSNumber) == NSNumber(bool: true)
|
||||
expect(options[NSInferMappingModelAutomaticallyOption] as? NSNumber) == NSNumber(bool: false)
|
||||
}
|
||||
|
||||
it("should return the right data for migration options") {
|
||||
let options = CoreData.Options.Migration.dict()
|
||||
let sqliteOptions = options[NSSQLitePragmasOption] as! [String: String]
|
||||
expect(sqliteOptions["journal_mode"]) == "DELETE"
|
||||
expect(options[NSMigratePersistentStoresAutomaticallyOption] as? NSNumber) == NSNumber(bool: true)
|
||||
expect(options[NSInferMappingModelAutomaticallyOption] as? NSNumber) == NSNumber(bool: true)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
25
Tests/Source/CoreData/Entities/StoreTests.swift
Executable file
25
Tests/Source/CoreData/Entities/StoreTests.swift
Executable file
@ -0,0 +1,25 @@
|
||||
import Foundation
|
||||
import Quick
|
||||
import Nimble
|
||||
|
||||
@testable import SugarRecord
|
||||
|
||||
class StoreTests: QuickSpec {
|
||||
|
||||
override func spec() {
|
||||
|
||||
describe("path generation") { () -> Void in
|
||||
|
||||
it("should return the url if the store is specified via an URL", closure: { () -> () in
|
||||
let url: NSURL = NSURL(string: "myurl")!
|
||||
expect(CoreData.Store.URL(url).path()) == url
|
||||
})
|
||||
|
||||
it("should return the store name in documents folder if it's a named store", closure: { () -> () in
|
||||
let name: String = "database.sqlite"
|
||||
expect(CoreData.Store.Named(name).path()) == NSURL(fileURLWithPath: documentsDirectory()).URLByAppendingPathComponent(name)
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
}
|
164
Tests/Source/CoreData/Storage/CoreDataDefaultStorageTests.swift
Executable file
164
Tests/Source/CoreData/Storage/CoreDataDefaultStorageTests.swift
Executable file
@ -0,0 +1,164 @@
|
||||
import Foundation
|
||||
import Quick
|
||||
import Nimble
|
||||
import CoreData
|
||||
|
||||
@testable import SugarRecord
|
||||
|
||||
class CoreDataDefaultStorageTests: QuickSpec {
|
||||
override func spec() {
|
||||
|
||||
describe("storage") { () -> Void in
|
||||
|
||||
var store: CoreData.Store!
|
||||
var model: CoreData.ObjectModel!
|
||||
var subject: CoreDataDefaultStorage!
|
||||
|
||||
beforeEach {
|
||||
store = CoreData.Store.Named("test")
|
||||
let bundle = NSBundle(forClass: self.classForCoder)
|
||||
model = CoreData.ObjectModel.Merged([bundle])
|
||||
subject = try! CoreDataDefaultStorage(store: store!, model: model!)
|
||||
}
|
||||
|
||||
afterEach {
|
||||
_ = try? subject?.removeStore()
|
||||
}
|
||||
|
||||
context("initialization") {
|
||||
|
||||
it("should create the database") {
|
||||
let path = store!.path().path!
|
||||
expect(NSFileManager.defaultManager().fileExistsAtPath(path)) == true
|
||||
}
|
||||
|
||||
it("should have the right description") {
|
||||
expect(subject?.description) == "CoreDataDefaultStorage"
|
||||
}
|
||||
|
||||
it("should have the right type") {
|
||||
expect(subject?.type) == .CoreData
|
||||
}
|
||||
|
||||
describe("root saving context") {
|
||||
it("should have the persistent store coordinator as parent") {
|
||||
expect(subject?.rootSavingContext.persistentStoreCoordinator) == subject?.persistentStoreCoordinator
|
||||
}
|
||||
it("should have private concurrency type") {
|
||||
expect(subject?.rootSavingContext.concurrencyType) == .PrivateQueueConcurrencyType
|
||||
}
|
||||
}
|
||||
|
||||
describe("save context") {
|
||||
it("should have the root saving context as parent") {
|
||||
expect((subject?.saveContext as! NSManagedObjectContext).parentContext) == subject?.rootSavingContext
|
||||
}
|
||||
|
||||
it("should have private concurrency type") {
|
||||
expect((subject?.saveContext as! NSManagedObjectContext).concurrencyType) == NSManagedObjectContextConcurrencyType.PrivateQueueConcurrencyType
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
describe("memory context") {
|
||||
it("should have the root saving context as parent") {
|
||||
expect((subject?.memoryContext as! NSManagedObjectContext).parentContext) == subject?.rootSavingContext
|
||||
}
|
||||
|
||||
it("should have private concurrency type") {
|
||||
expect((subject?.memoryContext as! NSManagedObjectContext).concurrencyType) == NSManagedObjectContextConcurrencyType.PrivateQueueConcurrencyType
|
||||
}
|
||||
}
|
||||
|
||||
describe("main context") {
|
||||
it("should have the root saving context as parent") {
|
||||
expect((subject?.mainContext as! NSManagedObjectContext).parentContext) == subject?.rootSavingContext
|
||||
}
|
||||
|
||||
it("should have main concurrency type") {
|
||||
expect((subject?.mainContext as! NSManagedObjectContext).concurrencyType) == NSManagedObjectContextConcurrencyType.MainQueueConcurrencyType
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
context("removal") {
|
||||
it("should properly remove the store") {
|
||||
_ = try? subject?.removeStore()
|
||||
let path = store!.path().path!
|
||||
expect(NSFileManager.defaultManager().fileExistsAtPath(path)) == false
|
||||
}
|
||||
}
|
||||
|
||||
context("persistence") {
|
||||
|
||||
it("shouldn't persist changes if we save the memory context") {
|
||||
waitUntil(action: { (done) -> Void in
|
||||
let memoryContext = subject!.memoryContext as! NSManagedObjectContext!
|
||||
let _: Track = try! memoryContext.create()
|
||||
try! memoryContext.save()
|
||||
_ = try? subject?.operation({ (context, save) -> Void in
|
||||
let resultsCount = try! context.request(Track.self).fetch().count
|
||||
expect(resultsCount) == 0
|
||||
done()
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
it("should persist the changes if it's save context") {
|
||||
waitUntil(action: { (done) -> Void in
|
||||
_ = try? subject?.operation({ (context, save) -> Void in
|
||||
let _: Track = try! context.create()
|
||||
save()
|
||||
})
|
||||
let tracksCount: Int? = try! subject?.mainContext.request(Track.self).fetch().count
|
||||
expect(tracksCount) == 1
|
||||
done()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
describe("-operation:") {
|
||||
|
||||
it("should return the inner value from the operation") {
|
||||
waitUntil(action: { (done) -> Void in
|
||||
let result: String = try! subject.operation({ (context, save) -> String in
|
||||
let issue: Track = try! context.create()
|
||||
issue.name = "trackName"
|
||||
save()
|
||||
return issue.name!
|
||||
})
|
||||
expect(result) == "trackName"
|
||||
done()
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
describe("-observable:") {
|
||||
|
||||
var request: Request<Track>!
|
||||
var observable: CoreDataObservable<Track>!
|
||||
|
||||
beforeEach {
|
||||
request = Request<Track>().filteredWith("name", equalTo: "test").sortedWith("name", ascending: true)
|
||||
observable = subject.observable(request) as! CoreDataObservable<Track>
|
||||
}
|
||||
|
||||
it("should have the correct request predicate") {
|
||||
expect(observable.fetchRequest.predicate) == request.predicate
|
||||
}
|
||||
|
||||
it("should have the correct request sort descriptor") {
|
||||
expect(observable.fetchRequest.sortDescriptors) == [request.sortDescriptor!]
|
||||
}
|
||||
|
||||
it("should have the correct context") {
|
||||
expect(observable.fetchedResultsController.managedObjectContext) == subject.mainContext! as? NSManagedObjectContext
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
52
Tests/Source/Foundation/Entities/RequestTests.swift
Executable file
52
Tests/Source/Foundation/Entities/RequestTests.swift
Executable file
@ -0,0 +1,52 @@
|
||||
import Foundation
|
||||
import Quick
|
||||
import Nimble
|
||||
import RealmSwift
|
||||
import Result
|
||||
|
||||
@testable import SugarRecord
|
||||
|
||||
class RequestTests: QuickSpec {
|
||||
|
||||
override func spec() {
|
||||
|
||||
describe("builders") {
|
||||
|
||||
it("-filteredWithPredicate") {
|
||||
let predicate: NSPredicate = NSPredicate(format: "name == TEST")
|
||||
let request: Request<Issue> = Request(testRealm()).filteredWith(predicate: predicate)
|
||||
expect(request.predicate) == predicate
|
||||
}
|
||||
|
||||
it("-filteredWith(key:value:)") {
|
||||
let predicate: NSPredicate = NSPredicate(format: "name == %@", "TEST")
|
||||
let request: Request<Issue> = Request(testRealm()).filteredWith("name", equalTo: "TEST")
|
||||
expect(request.predicate) == predicate
|
||||
}
|
||||
|
||||
it("-sortedWith(key:ascending:comparator)") {
|
||||
let descriptor: NSSortDescriptor = NSSortDescriptor(key: "name", ascending: true, comparator: { _ in return NSComparisonResult.OrderedSame})
|
||||
let request: Request<Issue> = Request(testRealm()).sortedWith("name", ascending: true, comparator: {_ in return NSComparisonResult.OrderedSame})
|
||||
expect(descriptor.key) == request.sortDescriptor?.key
|
||||
expect(descriptor.ascending) == request.sortDescriptor?.ascending
|
||||
}
|
||||
|
||||
it("-sortedWith(key:ascending)") {
|
||||
let descriptor: NSSortDescriptor = NSSortDescriptor(key: "name", ascending: true)
|
||||
let request: Request<Issue> = Request(testRealm()).sortedWith("name", ascending: true)
|
||||
expect(descriptor.key) == request.sortDescriptor?.key
|
||||
expect(descriptor.ascending) == request.sortDescriptor?.ascending
|
||||
}
|
||||
|
||||
it("sortedWith(key:ascending:selector)") {
|
||||
let descriptor: NSSortDescriptor = NSSortDescriptor(key: "name", ascending: true, selector: Selector("selector"))
|
||||
let request: Request<Issue> = Request(testRealm()).sortedWith("name", ascending: true, selector: Selector("selector"))
|
||||
expect(descriptor.key) == request.sortDescriptor?.key
|
||||
expect(descriptor.ascending) == request.sortDescriptor?.ascending
|
||||
expect(descriptor.selector) == request.sortDescriptor?.selector
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
18
Tests/Source/Foundation/Utils/DirUtilsTests.swift
Executable file
18
Tests/Source/Foundation/Utils/DirUtilsTests.swift
Executable file
@ -0,0 +1,18 @@
|
||||
import Foundation
|
||||
import Quick
|
||||
import Nimble
|
||||
|
||||
@testable import SugarRecord
|
||||
|
||||
class DirUtilsTests: QuickSpec {
|
||||
|
||||
override func spec() {
|
||||
|
||||
it("should return the proper documents directory") {
|
||||
let path = documentsDirectory()
|
||||
expect(path) == NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true)[0]
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
43
Tests/Source/Foundation/Version/VersionControllerTests.swift
Executable file
43
Tests/Source/Foundation/Version/VersionControllerTests.swift
Executable file
@ -0,0 +1,43 @@
|
||||
import Foundation
|
||||
import Quick
|
||||
import Nimble
|
||||
|
||||
@testable import SugarRecord
|
||||
|
||||
class VersionControllerTests: QuickSpec {
|
||||
override func spec() {
|
||||
var provider: MockVersionProvider!
|
||||
var logger: MockLogger!
|
||||
var subject: VersionController!
|
||||
|
||||
beforeSuite {
|
||||
provider = MockVersionProvider()
|
||||
logger = MockLogger()
|
||||
subject = VersionController(provider: provider, logger: logger)
|
||||
}
|
||||
|
||||
it("should log when there's a new version") {
|
||||
subject.check()
|
||||
expect(logger.logged) == true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - Mocking
|
||||
|
||||
private class MockVersionProvider: VersionProvider {
|
||||
private override func framework() -> String! {
|
||||
return "4.0.0"
|
||||
}
|
||||
private override func github(completion: String -> Void) {
|
||||
completion("4.0.1")
|
||||
}
|
||||
}
|
||||
|
||||
private class MockLogger: Logger {
|
||||
private var logged: Bool! = false
|
||||
private override func log(message: String) {
|
||||
self.logged = true
|
||||
}
|
||||
}
|
48
Tests/Source/Foundation/Version/VersionProviderTests.swift
Executable file
48
Tests/Source/Foundation/Version/VersionProviderTests.swift
Executable file
@ -0,0 +1,48 @@
|
||||
import Foundation
|
||||
import Quick
|
||||
import Nimble
|
||||
import OHHTTPStubs
|
||||
|
||||
@testable import SugarRecord
|
||||
|
||||
class VersionProviderTests: QuickSpec {
|
||||
override func spec() {
|
||||
|
||||
var subject: VersionProvider!
|
||||
|
||||
beforeEach {
|
||||
subject = VersionProvider()
|
||||
stub(isPath("/repos/pepibumur/sugarrecord/releases")) { _ in
|
||||
let object = [["tag_name": "3.1.0"]]
|
||||
return OHHTTPStubsResponse(JSONObject: object, statusCode: 200, headers: ["Content-Type":"application/json"])
|
||||
}
|
||||
}
|
||||
|
||||
afterEach {
|
||||
OHHTTPStubs.removeAllStubs()
|
||||
}
|
||||
|
||||
describe("-github:completion:") {
|
||||
it("should return the version") {
|
||||
waitUntil(timeout: 10, action: { (done) in
|
||||
subject.github({ (version) in
|
||||
expect(version) == "3.1.0"
|
||||
done()
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
describe("-framework") {
|
||||
it("should return a value") {
|
||||
expect(subject.framework()).toNot(beNil())
|
||||
}
|
||||
it("should have the correct format") {
|
||||
let regex = try! NSRegularExpression(pattern: "\\d+\\.\\d+\\.\\d+", options: [.CaseInsensitive])
|
||||
let version = subject.framework()
|
||||
let correctFormat = regex.firstMatchInString(version, options: [], range: NSMakeRange(0, version.characters.count)) != nil
|
||||
expect(correctFormat) == true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
77
Tests/Source/Realm/Entities/RealmObservableTests.swift
Executable file
77
Tests/Source/Realm/Entities/RealmObservableTests.swift
Executable file
@ -0,0 +1,77 @@
|
||||
import Foundation
|
||||
import Quick
|
||||
import Nimble
|
||||
import RealmSwift
|
||||
|
||||
@testable import SugarRecord
|
||||
|
||||
class RealmObservableTests: QuickSpec {
|
||||
|
||||
override func spec() {
|
||||
|
||||
var subject: RealmObservable<Issue>!
|
||||
var request: Request<Issue>!
|
||||
var realm: Realm!
|
||||
|
||||
beforeEach {
|
||||
realm = testRealm()
|
||||
realm.beginWrite()
|
||||
realm.create(Issue.self, value: ["id": "123", "name": "issue"], update: true)
|
||||
try! realm.commitWrite()
|
||||
request = Request<Issue>()
|
||||
subject = RealmObservable(request: request, realm: realm)
|
||||
}
|
||||
|
||||
afterEach {
|
||||
realm.beginWrite()
|
||||
realm.deleteAll()
|
||||
try! realm.commitWrite()
|
||||
}
|
||||
|
||||
describe("-observe:") {
|
||||
|
||||
context("initial") {
|
||||
it("should notify about the initial state") {
|
||||
waitUntil(action: { (done) in
|
||||
subject.observe({ (change) in
|
||||
switch change {
|
||||
case .Initial(let issues):
|
||||
expect(issues.first?.id) == "123"
|
||||
done()
|
||||
default:
|
||||
break
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
context("update") {
|
||||
|
||||
it("should notify about updates") {
|
||||
waitUntil(timeout: 5.0, action: { (done) in
|
||||
var called: Bool = false
|
||||
subject.observe({ (change) in
|
||||
switch change {
|
||||
case .Update(_, let insertions, _):
|
||||
if !called {
|
||||
expect(insertions.first?.element.id) == "666"
|
||||
done()
|
||||
called = true
|
||||
}
|
||||
default:
|
||||
break
|
||||
}
|
||||
})
|
||||
realm.beginWrite()
|
||||
realm.create(Issue.self, value: ["id": "666", "name": "issue"], update: true)
|
||||
try! realm.commitWrite()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
82
Tests/Source/Realm/Extensions/RealmTests.swift
Executable file
82
Tests/Source/Realm/Extensions/RealmTests.swift
Executable file
@ -0,0 +1,82 @@
|
||||
import Foundation
|
||||
import Quick
|
||||
import Nimble
|
||||
import RealmSwift
|
||||
import Result
|
||||
|
||||
@testable import SugarRecord
|
||||
|
||||
class RealmTests: QuickSpec {
|
||||
|
||||
override func spec() {
|
||||
|
||||
var subject: Realm?
|
||||
|
||||
beforeEach {
|
||||
subject = testRealm()
|
||||
}
|
||||
|
||||
afterEach {
|
||||
subject!.beginWrite()
|
||||
subject!.deleteAll()
|
||||
_ = try? subject!.commitWrite()
|
||||
}
|
||||
|
||||
describe("fetching") {
|
||||
it("should properly fetch objects persisted in the database") {
|
||||
let issue = Issue()
|
||||
subject?.beginWrite()
|
||||
subject?.add(issue)
|
||||
_ = try? subject?.commitWrite()
|
||||
let fetched: [Issue] = try! subject!.request(Issue.self).fetch()
|
||||
expect(fetched.count) == 1
|
||||
}
|
||||
}
|
||||
|
||||
describe("insert") {
|
||||
it("should return the object inserted in the Realm") {
|
||||
subject!.beginWrite()
|
||||
let inserted: Issue = try! subject!.create()
|
||||
_ = try? subject!.commitWrite()
|
||||
_ = inserted
|
||||
expect(subject!.objects(Issue.self).count) == 1
|
||||
}
|
||||
}
|
||||
|
||||
describe("remove") {
|
||||
|
||||
it("should remove objects from Realm properly") {
|
||||
try! subject!.write({ () -> Void in
|
||||
let issue: Issue = Issue()
|
||||
issue.name = "test"
|
||||
subject!.add(issue)
|
||||
})
|
||||
|
||||
// Fetching
|
||||
let _issue = subject!.objects(Issue.self).filter("name == %@", "test").first!
|
||||
subject?.beginWrite()
|
||||
try! (subject as? Context)!.remove([_issue])
|
||||
try! subject?.commitWrite()
|
||||
|
||||
// Testing
|
||||
expect(subject!.objects(Issue.self).count) == 0
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
describe("removeAll") {
|
||||
it("should remove all the objects in the Realm") {
|
||||
try! subject!.write({ () -> Void in
|
||||
let issue: Issue = Issue()
|
||||
issue.name = "test"
|
||||
subject!.add(issue)
|
||||
})
|
||||
subject?.beginWrite()
|
||||
try! (subject as? Context)!.removeAll()
|
||||
try! subject?.commitWrite()
|
||||
expect(subject!.objects(Issue.self).count) == 0
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
46
Tests/Source/Realm/Extensions/ResultsTests.swift
Executable file
46
Tests/Source/Realm/Extensions/ResultsTests.swift
Executable file
@ -0,0 +1,46 @@
|
||||
import Foundation
|
||||
import Quick
|
||||
import Nimble
|
||||
import RealmSwift
|
||||
|
||||
@testable import SugarRecord
|
||||
|
||||
class ResultsTests: QuickSpec {
|
||||
|
||||
override func spec() {
|
||||
|
||||
var realm: Realm?
|
||||
|
||||
beforeEach {
|
||||
realm = testRealm()
|
||||
}
|
||||
|
||||
afterEach {
|
||||
realm!.beginWrite()
|
||||
realm!.deleteAll()
|
||||
_ = try? realm!.commitWrite()
|
||||
}
|
||||
|
||||
describe("array generation") {
|
||||
|
||||
it("should return the same number of elements") {
|
||||
let issue = Issue()
|
||||
realm?.beginWrite()
|
||||
realm?.add(issue)
|
||||
_ = try? realm?.commitWrite()
|
||||
expect(realm?.objects(Issue.self).toArray().count) == 1
|
||||
}
|
||||
|
||||
it("should return the proper elements") {
|
||||
let issue = Issue()
|
||||
realm?.beginWrite()
|
||||
issue.name = "test"
|
||||
realm?.add(issue)
|
||||
_ = try? realm?.commitWrite()
|
||||
expect(realm?.objects(Issue.self).toArray().first?.name) == "test"
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
104
Tests/Source/Realm/Storages/RealmDefaultStorageTests.swift
Executable file
104
Tests/Source/Realm/Storages/RealmDefaultStorageTests.swift
Executable file
@ -0,0 +1,104 @@
|
||||
import Foundation
|
||||
import Quick
|
||||
import Nimble
|
||||
import RealmSwift
|
||||
|
||||
@testable import SugarRecord
|
||||
|
||||
class RealmDefaultStorageTests: QuickSpec {
|
||||
|
||||
override func spec() {
|
||||
|
||||
var subject: RealmDefaultStorage!
|
||||
|
||||
beforeEach {
|
||||
subject = RealmDefaultStorage()
|
||||
}
|
||||
|
||||
afterEach {
|
||||
_ = try? subject.removeStore()
|
||||
}
|
||||
|
||||
describe("-description") {
|
||||
it("should have the correct description") {
|
||||
expect(subject.description) == "RealmDefaultStorage"
|
||||
}
|
||||
}
|
||||
|
||||
describe("-type") {
|
||||
it("should have the correct type") {
|
||||
expect(subject.type) == StorageType.Realm
|
||||
}
|
||||
}
|
||||
|
||||
describe("-memoryContext") {
|
||||
it("should return a memory realm for the memory context") {
|
||||
let memoryRealm: Realm? = subject.memoryContext as? Realm
|
||||
expect(memoryRealm?.configuration.inMemoryIdentifier) == "MemoryRealm"
|
||||
}
|
||||
}
|
||||
|
||||
describe("-removeStore") {
|
||||
it("should remove the storage") {
|
||||
_ = try? subject.removeStore()
|
||||
let path = Realm.Configuration.defaultConfiguration.fileURL?.absoluteString
|
||||
expect(NSFileManager.defaultManager().fileExistsAtPath(path!)) == false
|
||||
}
|
||||
|
||||
it("shouldn't throw an exception") {
|
||||
expect{ try subject!.removeStore() }.toNot(throwError())
|
||||
}
|
||||
}
|
||||
|
||||
describe("-operation:") {
|
||||
|
||||
it("should save the changes if the save closure is called") {
|
||||
waitUntil(action: { (done) -> Void in
|
||||
_ = try? subject.operation({ (context, save) -> Void in
|
||||
let issue: Issue = try! context.create()
|
||||
issue.name = "test"
|
||||
save()
|
||||
})
|
||||
let fetched = try! subject.mainContext.request(Issue.self).fetch()
|
||||
expect(fetched.count) == 1
|
||||
done()
|
||||
})
|
||||
}
|
||||
|
||||
it("shouldn't persist the changes if the save closure is not called") {
|
||||
waitUntil(action: { (done) -> Void in
|
||||
_ = try? subject.operation({ (context, save) -> Void in
|
||||
let issue: Issue = try! context.create()
|
||||
issue.name = "test"
|
||||
})
|
||||
let fetched = try! subject.mainContext.request(Issue.self).fetch()
|
||||
expect(fetched.count) == 0
|
||||
done()
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
describe("-observable") {
|
||||
|
||||
var observable: RealmObservable<Issue>!
|
||||
var request: Request<Issue>!
|
||||
|
||||
beforeEach {
|
||||
request = Request()
|
||||
observable = subject.observable(request) as! RealmObservable<Issue>
|
||||
}
|
||||
|
||||
it("should have the correct request") {
|
||||
expect(observable.realm) == subject.mainContext as? Realm
|
||||
}
|
||||
|
||||
it("should have the correct realm") {
|
||||
expect((observable as RequestObservable<Issue>).request) == request
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -1,61 +1,47 @@
|
||||
# Requires
|
||||
require 'yaml'
|
||||
COMMIT_MESSAGE = "Bump podspec to"
|
||||
|
||||
# Fastlane Constants
|
||||
fastlane_version "1.54.0"
|
||||
default_platform :ios
|
||||
|
||||
# Constants
|
||||
PODSPEC = "SugarRecord.podspec"
|
||||
WORKSPACE = "SugarRecord.xcworkspace"
|
||||
SCHEME_TESTS = "SugarRecordTests"
|
||||
REPOSITORY = "pepibumur/SugarRecord"
|
||||
|
||||
# Lanes
|
||||
desc "Setup everything needed to work on the project"
|
||||
lane :setup do
|
||||
sh("carthage checkout --project-directory \"../\"")
|
||||
lane :pods do
|
||||
cocoapods(podfile: "Examples/")
|
||||
end
|
||||
|
||||
desc "Runs the tests suite"
|
||||
lane :tests do
|
||||
scan(workspace: WORKSPACE, scheme: SCHEME_TESTS, skip_build: true)
|
||||
scan(workspace: "Examples/Examples.xcworkspace", scheme: "iOS", clean: true)
|
||||
end
|
||||
|
||||
desc "Builds all the project targets"
|
||||
lane :build do
|
||||
xcodebuild(workspace: WORKSPACE, scheme: 'SugarRecord-CoreData-iOS', configuration: "Debug", build_settings: {"ONLY_ACTIVE_ARCH" => "NO", "CODE_SIGNING_REQUIRED" => "NO", "CODE_SIGN_IDENTITY" => "" } )
|
||||
xcodebuild(workspace: WORKSPACE, scheme: 'SugarRecord-Realm-iOS', configuration: "Debug", build_settings: {"ONLY_ACTIVE_ARCH" => "NO", "CODE_SIGNING_REQUIRED" => "NO", "CODE_SIGN_IDENTITY" => "" } )
|
||||
xcodebuild(workspace: WORKSPACE, scheme: 'SugarRecord-CoreData-OSX', configuration: "Debug", build_settings: {"ONLY_ACTIVE_ARCH" => "NO", "CODE_SIGNING_REQUIRED" => "NO", "CODE_SIGN_IDENTITY" => "" } )
|
||||
xcodebuild(workspace: WORKSPACE, scheme: 'SugarRecord-Realm-OSX', configuration: "Debug", build_settings: {"ONLY_ACTIVE_ARCH" => "NO", "CODE_SIGNING_REQUIRED" => "NO", "CODE_SIGN_IDENTITY" => "" } )
|
||||
xcodebuild(workspace: WORKSPACE, scheme: 'SugarRecord-CoreData-watchOS', configuration: "Debug", build_settings: {"ONLY_ACTIVE_ARCH" => "NO", "CODE_SIGNING_REQUIRED" => "NO", "CODE_SIGN_IDENTITY" => "" } )
|
||||
xcodebuild(workspace: WORKSPACE, scheme: 'SugarRecord-Realm-watchOS', configuration: "Debug", build_settings: {"ONLY_ACTIVE_ARCH" => "NO", "CODE_SIGNING_REQUIRED" => "NO", "CODE_SIGN_IDENTITY" => "" } )
|
||||
xcodebuild(workspace: WORKSPACE, scheme: 'SugarRecord-CoreData-tvOS', configuration: "Debug", build_settings: {"ONLY_ACTIVE_ARCH" => "NO", "CODE_SIGNING_REQUIRED" => "NO", "CODE_SIGN_IDENTITY" => "" } )
|
||||
xcodebuild(workspace: WORKSPACE, scheme: 'SugarRecord-Realm-tvOS', configuration: "Debug", build_settings: {"ONLY_ACTIVE_ARCH" => "NO", "CODE_SIGNING_REQUIRED" => "NO", "CODE_SIGN_IDENTITY" => "" } )
|
||||
end
|
||||
|
||||
lane :ci do
|
||||
setup
|
||||
build
|
||||
lane :travis do
|
||||
pods
|
||||
tests
|
||||
danger
|
||||
end
|
||||
|
||||
lane :deploy do
|
||||
ensure_git_branch
|
||||
version = version_bump_podspec(path: PODSPEC, bump_type: "patch")
|
||||
pod_push(path: PODSPEC)
|
||||
changelog = changelog_from_git_commits(
|
||||
between: [last_git_tag, 'HEAD'],
|
||||
pretty: '- (%ae) %s',
|
||||
include_merges: false
|
||||
)
|
||||
|
||||
lane :push do
|
||||
podspec = "SugarRecord.podspec"
|
||||
last_version = version_get_podspec(path: podspec)
|
||||
version = version_bump_podspec(path: podspec)
|
||||
git_commit(path: [podspec, "./Examples/Podfile.lock"], message: "#{COMMIT_MESSAGE} #{version}")
|
||||
changelog = changelog_from_git_commits
|
||||
changelog ||= "No changelog"
|
||||
github_release = set_github_release(
|
||||
repository_name: REPOSITORY,
|
||||
repository_name: "carambalabs/SugarRecord",
|
||||
api_token: ENV['GITHUB_TOKEN'],
|
||||
name: "Version #{version}",
|
||||
name: version,
|
||||
tag_name: version,
|
||||
description: changelog,
|
||||
commitish: "master"
|
||||
)
|
||||
push_to_git_remote
|
||||
sh("git fetch --tags")
|
||||
push_to_git_remote(remote_branch: 'master', force: false, tags: true)
|
||||
pod_push(allow_warnings: true, verbose: true)
|
||||
end
|
||||
|
||||
# desc "Builds all the project targets"
|
||||
# lane :build do
|
||||
# xcodebuild(workspace: WORKSPACE, scheme: 'SugarRecord-CoreData-iOS', configuration: "Debug", build_settings: {"ONLY_ACTIVE_ARCH" => "NO", "CODE_SIGNING_REQUIRED" => "NO", "CODE_SIGN_IDENTITY" => "" } )
|
||||
# xcodebuild(workspace: WORKSPACE, scheme: 'SugarRecord-Realm-iOS', configuration: "Debug", build_settings: {"ONLY_ACTIVE_ARCH" => "NO", "CODE_SIGNING_REQUIRED" => "NO", "CODE_SIGN_IDENTITY" => "" } )
|
||||
# xcodebuild(workspace: WORKSPACE, scheme: 'SugarRecord-CoreData-OSX', configuration: "Debug", build_settings: {"ONLY_ACTIVE_ARCH" => "NO", "CODE_SIGNING_REQUIRED" => "NO", "CODE_SIGN_IDENTITY" => "" } )
|
||||
# xcodebuild(workspace: WORKSPACE, scheme: 'SugarRecord-Realm-OSX', configuration: "Debug", build_settings: {"ONLY_ACTIVE_ARCH" => "NO", "CODE_SIGNING_REQUIRED" => "NO", "CODE_SIGN_IDENTITY" => "" } )
|
||||
# xcodebuild(workspace: WORKSPACE, scheme: 'SugarRecord-CoreData-watchOS', configuration: "Debug", build_settings: {"ONLY_ACTIVE_ARCH" => "NO", "CODE_SIGNING_REQUIRED" => "NO", "CODE_SIGN_IDENTITY" => "" } )
|
||||
# xcodebuild(workspace: WORKSPACE, scheme: 'SugarRecord-Realm-watchOS', configuration: "Debug", build_settings: {"ONLY_ACTIVE_ARCH" => "NO", "CODE_SIGNING_REQUIRED" => "NO", "CODE_SIGN_IDENTITY" => "" } )
|
||||
# xcodebuild(workspace: WORKSPACE, scheme: 'SugarRecord-CoreData-tvOS', configuration: "Debug", build_settings: {"ONLY_ACTIVE_ARCH" => "NO", "CODE_SIGNING_REQUIRED" => "NO", "CODE_SIGN_IDENTITY" => "" } )
|
||||
# xcodebuild(workspace: WORKSPACE, scheme: 'SugarRecord-Realm-tvOS', configuration: "Debug", build_settings: {"ONLY_ACTIVE_ARCH" => "NO", "CODE_SIGNING_REQUIRED" => "NO", "CODE_SIGN_IDENTITY" => "" } )
|
||||
# end
|
Loading…
Reference in New Issue
Block a user