@@ -77,20 +77,32 @@ - (id)objectFromFactory:(NSString *)factoryName
77
77
- (void )defineDefaultFactories
78
78
{
79
79
[self defineFactory: RKTestFactoryDefaultNamesClient withBlock: ^id {
80
- RKClient *client = [RKClient clientWithBaseURL: self .baseURL];
81
- client.requestQueue .suspended = NO ;
82
- [client.reachabilityObserver getFlags ];
80
+ __block RKClient *client;
81
+
82
+ RKLogSilenceComponentWhileExecutingBlock (lcl_cRestKitNetworkReachability, ^{
83
+ RKLogSilenceComponentWhileExecutingBlock (lcl_cRestKitSupport, ^{
84
+ client = [RKClient clientWithBaseURL: self .baseURL];
85
+ client.requestQueue .suspended = NO ;
86
+ [client.reachabilityObserver getFlags ];
87
+ });
88
+ });
83
89
84
90
return client;
85
91
}];
86
92
87
93
[self defineFactory: RKTestFactoryDefaultNamesObjectManager withBlock: ^id {
88
- RKObjectManager *objectManager = [RKObjectManager managerWithBaseURL: self .baseURL];
89
- RKObjectMappingProvider *mappingProvider = [self objectFromFactory: RKTestFactoryDefaultNamesMappingProvider];
90
- objectManager.mappingProvider = mappingProvider;
91
-
92
- // Force reachability determination
93
- [objectManager.client.reachabilityObserver getFlags ];
94
+ __block RKObjectManager *objectManager;
95
+
96
+ RKLogSilenceComponentWhileExecutingBlock (lcl_cRestKitNetworkReachability, ^{
97
+ RKLogSilenceComponentWhileExecutingBlock (lcl_cRestKitSupport, ^{
98
+ objectManager = [RKObjectManager managerWithBaseURL: self .baseURL];
99
+ RKObjectMappingProvider *mappingProvider = [self objectFromFactory: RKTestFactoryDefaultNamesMappingProvider];
100
+ objectManager.mappingProvider = mappingProvider;
101
+
102
+ // Force reachability determination
103
+ [objectManager.client.reachabilityObserver getFlags ];
104
+ });
105
+ });
94
106
95
107
return objectManager;
96
108
}];
@@ -194,7 +206,12 @@ + (void)setUp
194
206
{
195
207
[RKObjectManager setDefaultMappingQueue: dispatch_queue_create (" org.restkit.ObjectMapping" , DISPATCH_QUEUE_SERIAL)];
196
208
[RKObjectMapping setDefaultDateFormatters: nil ];
197
- [RKManagedObjectStore deleteStoreInApplicationDataDirectoryWithFilename: RKTestFactoryDefaultStoreFilename];
209
+
210
+ // Delete the store if it exists
211
+ NSString *path = [[RKDirectory applicationDataDirectory ] stringByAppendingPathComponent: RKTestFactoryDefaultStoreFilename];
212
+ if ([[NSFileManager defaultManager ] fileExistsAtPath: path]) {
213
+ [RKManagedObjectStore deleteStoreInApplicationDataDirectoryWithFilename: RKTestFactoryDefaultStoreFilename];
214
+ }
198
215
199
216
if ([self respondsToSelector: @selector (didSetUp )]) {
200
217
[self didSetUp ];
@@ -218,7 +235,7 @@ + (void)clearCacheDirectory
218
235
NSString * cachePath = [RKDirectory cachesDirectory ];
219
236
BOOL success = [[NSFileManager defaultManager ] removeItemAtPath: cachePath error: &error];
220
237
if (success) {
221
- RKLogInfo (@" Cleared cache directory..." );
238
+ RKLogDebug (@" Cleared cache directory..." );
222
239
success = [[NSFileManager defaultManager ] createDirectoryAtPath: cachePath withIntermediateDirectories: YES attributes: nil error: &error];
223
240
if (!success) {
224
241
RKLogError (@" Failed creation of cache path '%@ ': %@ " , cachePath, [error localizedDescription ]);
0 commit comments