@@ -34,15 +34,14 @@ class AttemptEntitySpec: QuickSpec {
3434 let attempt = makeAttempt ( dataset: choiceDataset)
3535
3636 // When
37- _ = AttemptEntity (
38- attempt : attempt ,
39- managedObjectContext : testCoreDataStack . managedObjectContext
37+ _ = AttemptEntity . insert (
38+ into : testCoreDataStack . managedObjectContext ,
39+ attempt : attempt
4040 )
4141 testCoreDataStack. saveContext ( )
4242
4343 // Then
44- let request = AttemptEntity . fetchRequest
45- request. sortDescriptors = AttemptEntity . defaultSortDescriptors
44+ let request = AttemptEntity . sortedFetchRequest
4645
4746 let attempts = try ! testCoreDataStack. managedObjectContext. fetch ( request)
4847 expect ( attempts. count) == 1
@@ -65,15 +64,14 @@ class AttemptEntitySpec: QuickSpec {
6564 let attempt = makeAttempt ( dataset: fillBlanksDataset)
6665
6766 // When
68- _ = AttemptEntity (
69- attempt : attempt ,
70- managedObjectContext : testCoreDataStack . managedObjectContext
67+ _ = AttemptEntity . insert (
68+ into : testCoreDataStack . managedObjectContext ,
69+ attempt : attempt
7170 )
7271 testCoreDataStack. saveContext ( )
7372
7473 // Then
75- let request = AttemptEntity . fetchRequest
76- request. sortDescriptors = AttemptEntity . defaultSortDescriptors
74+ let request = AttemptEntity . sortedFetchRequest
7775
7876 let attempts = try ! testCoreDataStack. managedObjectContext. fetch ( request)
7977 expect ( attempts. count) == 1
@@ -96,15 +94,14 @@ class AttemptEntitySpec: QuickSpec {
9694 let attempt = makeAttempt ( dataset: freeAnswerDataset)
9795
9896 // When
99- _ = AttemptEntity (
100- attempt : attempt ,
101- managedObjectContext : testCoreDataStack . managedObjectContext
97+ _ = AttemptEntity . insert (
98+ into : testCoreDataStack . managedObjectContext ,
99+ attempt : attempt
102100 )
103101 testCoreDataStack. saveContext ( )
104102
105103 // Then
106- let request = AttemptEntity . fetchRequest
107- request. sortDescriptors = AttemptEntity . defaultSortDescriptors
104+ let request = AttemptEntity . sortedFetchRequest
108105
109106 let attempts = try ! testCoreDataStack. managedObjectContext. fetch ( request)
110107 expect ( attempts. count) == 1
@@ -127,15 +124,14 @@ class AttemptEntitySpec: QuickSpec {
127124 let attempt = makeAttempt ( dataset: matchingDataset)
128125
129126 // When
130- _ = AttemptEntity (
131- attempt : attempt ,
132- managedObjectContext : testCoreDataStack . managedObjectContext
127+ _ = AttemptEntity . insert (
128+ into : testCoreDataStack . managedObjectContext ,
129+ attempt : attempt
133130 )
134131 testCoreDataStack. saveContext ( )
135132
136133 // Then
137- let request = AttemptEntity . fetchRequest
138- request. sortDescriptors = AttemptEntity . defaultSortDescriptors
134+ let request = AttemptEntity . sortedFetchRequest
139135
140136 let attempts = try ! testCoreDataStack. managedObjectContext. fetch ( request)
141137 expect ( attempts. count) == 1
@@ -158,15 +154,14 @@ class AttemptEntitySpec: QuickSpec {
158154 let attempt = makeAttempt ( dataset: sortingDataset)
159155
160156 // When
161- _ = AttemptEntity (
162- attempt : attempt ,
163- managedObjectContext : testCoreDataStack . managedObjectContext
157+ _ = AttemptEntity . insert (
158+ into : testCoreDataStack . managedObjectContext ,
159+ attempt : attempt
164160 )
165161 testCoreDataStack. saveContext ( )
166162
167163 // Then
168- let request = AttemptEntity . fetchRequest
169- request. sortDescriptors = AttemptEntity . defaultSortDescriptors
164+ let request = AttemptEntity . sortedFetchRequest
170165
171166 let attempts = try ! testCoreDataStack. managedObjectContext. fetch ( request)
172167 expect ( attempts. count) == 1
@@ -189,15 +184,14 @@ class AttemptEntitySpec: QuickSpec {
189184 let attempt = makeAttempt ( dataset: stringDataset)
190185
191186 // When
192- _ = AttemptEntity (
193- attempt : attempt ,
194- managedObjectContext : testCoreDataStack . managedObjectContext
187+ _ = AttemptEntity . insert (
188+ into : testCoreDataStack . managedObjectContext ,
189+ attempt : attempt
195190 )
196191 testCoreDataStack. saveContext ( )
197192
198193 // Then
199- let request = AttemptEntity . fetchRequest
200- request. sortDescriptors = AttemptEntity . defaultSortDescriptors
194+ let request = AttemptEntity . sortedFetchRequest
201195
202196 let attempts = try ! testCoreDataStack. managedObjectContext. fetch ( request)
203197 expect ( attempts. count) == 1
@@ -220,15 +214,14 @@ class AttemptEntitySpec: QuickSpec {
220214 let attempt = makeAttempt ( dataset: tableDataset)
221215
222216 // When
223- _ = AttemptEntity (
224- attempt : attempt ,
225- managedObjectContext : testCoreDataStack . managedObjectContext
217+ _ = AttemptEntity . insert (
218+ into : testCoreDataStack . managedObjectContext ,
219+ attempt : attempt
226220 )
227221 testCoreDataStack. saveContext ( )
228222
229223 // Then
230- let request = AttemptEntity . fetchRequest
231- request. sortDescriptors = AttemptEntity . defaultSortDescriptors
224+ let request = AttemptEntity . sortedFetchRequest
232225
233226 let attempts = try ! testCoreDataStack. managedObjectContext. fetch ( request)
234227 expect ( attempts. count) == 1
0 commit comments