mirror of
https://github.com/zhigang1992/RestKit.git
synced 2026-04-23 12:27:52 +08:00
Enabled support and tests for creation of intermediate directories during RKCache initialization. closes #667
This commit is contained in:
@@ -45,7 +45,7 @@
|
||||
if (!fileExists) {
|
||||
NSError* error = nil;
|
||||
BOOL created = [fileManager createDirectoryAtPath:path
|
||||
withIntermediateDirectories:NO
|
||||
withIntermediateDirectories:YES
|
||||
attributes:nil
|
||||
error:&error];
|
||||
if (!created || error != nil) {
|
||||
|
||||
@@ -521,6 +521,8 @@
|
||||
259C3027151280A1003066A2 /* grayArrow@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 25EC1AE314F8022600C3CF3F /* grayArrow@2x.png */; };
|
||||
259C3028151280A1003066A2 /* whiteArrow.png in Resources */ = {isa = PBXBuildFile; fileRef = 25EC1AE414F8022600C3CF3F /* whiteArrow.png */; };
|
||||
259C3029151280A1003066A2 /* whiteArrow@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 25EC1AE514F8022600C3CF3F /* whiteArrow@2x.png */; };
|
||||
25A2476E153E667E003240B6 /* RKCacheTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 25A2476D153E667E003240B6 /* RKCacheTest.m */; };
|
||||
25A2476F153E667E003240B6 /* RKCacheTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 25A2476D153E667E003240B6 /* RKCacheTest.m */; };
|
||||
25A34245147D8AAA0009758D /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 25A34244147D8AAA0009758D /* Security.framework */; };
|
||||
25B408261491CDDC00F21111 /* RKDirectory.h in Headers */ = {isa = PBXBuildFile; fileRef = 25B408241491CDDB00F21111 /* RKDirectory.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
25B408271491CDDC00F21111 /* RKDirectory.h in Headers */ = {isa = PBXBuildFile; fileRef = 25B408241491CDDB00F21111 /* RKDirectory.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
@@ -1040,6 +1042,7 @@
|
||||
257ABAB41511371C00CCAA76 /* NSManagedObject+RKAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSManagedObject+RKAdditions.h"; sourceTree = "<group>"; };
|
||||
257ABAB51511371D00CCAA76 /* NSManagedObject+RKAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSManagedObject+RKAdditions.m"; sourceTree = "<group>"; };
|
||||
259C301615128079003066A2 /* RestKitResources.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RestKitResources.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
25A2476D153E667E003240B6 /* RKCacheTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RKCacheTest.m; sourceTree = "<group>"; };
|
||||
25A34244147D8AAA0009758D /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = SDKs/MacOSX10.7.sdk/System/Library/Frameworks/Security.framework; sourceTree = DEVELOPER_DIR; };
|
||||
25B408241491CDDB00F21111 /* RKDirectory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RKDirectory.h; sourceTree = "<group>"; };
|
||||
25B408251491CDDB00F21111 /* RKDirectory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RKDirectory.m; sourceTree = "<group>"; };
|
||||
@@ -1909,6 +1912,7 @@
|
||||
251610571456F2330060A5C5 /* RKXMLParserTest.m */,
|
||||
252A2033153477870078F8AD /* NSArray+RKAdditionsTest.m */,
|
||||
2501405215366000004E0466 /* RKObjectiveCppTest.mm */,
|
||||
25A2476D153E667E003240B6 /* RKCacheTest.m */,
|
||||
);
|
||||
name = Support;
|
||||
path = Logic/Support;
|
||||
@@ -2823,6 +2827,7 @@
|
||||
25DB7508151BD551009F01AF /* NSManagedObject+ActiveRecordTest.m in Sources */,
|
||||
252A2034153477870078F8AD /* NSArray+RKAdditionsTest.m in Sources */,
|
||||
2501405315366000004E0466 /* RKObjectiveCppTest.mm in Sources */,
|
||||
25A2476E153E667E003240B6 /* RKCacheTest.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -3006,6 +3011,7 @@
|
||||
25DB7509151BD551009F01AF /* NSManagedObject+ActiveRecordTest.m in Sources */,
|
||||
252A2035153477870078F8AD /* NSArray+RKAdditionsTest.m in Sources */,
|
||||
2501405415366000004E0466 /* RKObjectiveCppTest.mm in Sources */,
|
||||
25A2476F153E667E003240B6 /* RKCacheTest.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
||||
32
Tests/Logic/Support/RKCacheTest.m
Normal file
32
Tests/Logic/Support/RKCacheTest.m
Normal file
@@ -0,0 +1,32 @@
|
||||
//
|
||||
// RKCacheTest.m
|
||||
// RestKit
|
||||
//
|
||||
// Created by Blake Watters on 4/17/12.
|
||||
// Copyright (c) 2012 RestKit. All rights reserved.
|
||||
//
|
||||
|
||||
#import "RKTestEnvironment.h"
|
||||
#import "RKDirectory.h"
|
||||
|
||||
@interface RKCacheTest : RKTestCase
|
||||
|
||||
@end
|
||||
|
||||
@implementation RKCacheTest
|
||||
|
||||
- (void)testCreationOfIntermediateDirectories
|
||||
{
|
||||
NSString *cachePath = [RKDirectory cachesDirectory];
|
||||
NSString *subPath = [cachePath stringByAppendingPathComponent:@"TestPath"];
|
||||
NSError *error = nil;
|
||||
[[NSFileManager defaultManager] removeItemAtPath:cachePath error:&error];
|
||||
|
||||
[[RKCache alloc] initWithPath:subPath subDirectories:nil];
|
||||
BOOL isDirectory;
|
||||
BOOL fileExists = [[NSFileManager defaultManager] fileExistsAtPath:subPath isDirectory:&isDirectory];
|
||||
assertThatBool(fileExists, is(equalToBool(YES)));
|
||||
assertThatBool(isDirectory, is(equalToBool(YES)));
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user