mirror of
https://github.com/zhigang1992/RestKit.git
synced 2026-01-12 22:51:50 +08:00
adding the otrestspecs_rails project to the mix
This commit is contained in:
@@ -14,6 +14,26 @@
|
||||
253BBE961076AB1C00C804B2 /* NSString+InflectionSupport.h in Headers */ = {isa = PBXBuildFile; fileRef = 253BBE941076AB1C00C804B2 /* NSString+InflectionSupport.h */; };
|
||||
253BBE971076AB1C00C804B2 /* NSString+InflectionSupport.m in Sources */ = {isa = PBXBuildFile; fileRef = 253BBE951076AB1C00C804B2 /* NSString+InflectionSupport.m */; };
|
||||
253BBE981076AB1C00C804B2 /* NSString+InflectionSupport.m in Sources */ = {isa = PBXBuildFile; fileRef = 253BBE951076AB1C00C804B2 /* NSString+InflectionSupport.m */; };
|
||||
255DE05A10FF9DA500A85891 /* OTRestModelManagerSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 255DE05910FF9DA500A85891 /* OTRestModelManagerSpec.m */; };
|
||||
255DE05E10FFA05800A85891 /* Human.m in Sources */ = {isa = PBXBuildFile; fileRef = 255DE05D10FFA05800A85891 /* Human.m */; };
|
||||
255DE0B710FFA52E00A85891 /* Data Model.xcdatamodel in Sources */ = {isa = PBXBuildFile; fileRef = 255DE0B610FFA52E00A85891 /* Data Model.xcdatamodel */; };
|
||||
255DE0DB10FFAB7700A85891 /* OTRestModelManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 3FBF1D38103614E500E307AC /* OTRestModelManager.m */; };
|
||||
255DE0DC10FFAB7B00A85891 /* OTRestModelLoader.m in Sources */ = {isa = PBXBuildFile; fileRef = 2580B067102E0F1000832D07 /* OTRestModelLoader.m */; };
|
||||
255DE0DD10FFAB7E00A85891 /* OTRestManagedObjectStore.m in Sources */ = {isa = PBXBuildFile; fileRef = 2525EBEA106961DD0069EBED /* OTRestManagedObjectStore.m */; };
|
||||
255DE0DE10FFAB7F00A85891 /* OTRestManagedModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 25FCDDDA1035BC85005418A7 /* OTRestManagedModel.m */; };
|
||||
255DE0E210FFABA500A85891 /* CoreData.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 255DE0E110FFABA500A85891 /* CoreData.framework */; };
|
||||
255DE0E510FFABBB00A85891 /* OTRestResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = 3F4E18F1102DD38800320118 /* OTRestResponse.m */; };
|
||||
255DE0E610FFABBC00A85891 /* OTRestRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 3F4E18EE102DD38700320118 /* OTRestRequest.m */; };
|
||||
255DE0E710FFABBD00A85891 /* OTRestParamsFileAttachment.m in Sources */ = {isa = PBXBuildFile; fileRef = 3F4E18EC102DD38700320118 /* OTRestParamsFileAttachment.m */; };
|
||||
255DE0E810FFABBE00A85891 /* OTRestParamsDataAttachment.m in Sources */ = {isa = PBXBuildFile; fileRef = 3F4E18EA102DD38700320118 /* OTRestParamsDataAttachment.m */; };
|
||||
255DE0E910FFABC100A85891 /* OTRestParamsAttachment.m in Sources */ = {isa = PBXBuildFile; fileRef = 3F4E18E8102DD38700320118 /* OTRestParamsAttachment.m */; };
|
||||
255DE0EA10FFABC300A85891 /* OTRestParams.m in Sources */ = {isa = PBXBuildFile; fileRef = 3F4E18E6102DD38700320118 /* OTRestParams.m */; };
|
||||
255DE0EB10FFABC600A85891 /* OTRestNotifications.m in Sources */ = {isa = PBXBuildFile; fileRef = 2525F99F106C0FF40069EBED /* OTRestNotifications.m */; };
|
||||
255DE0EE10FFABDD00A85891 /* OTRestClient.m in Sources */ = {isa = PBXBuildFile; fileRef = 3F4E18E4102DD38700320118 /* OTRestClient.m */; };
|
||||
255DE0EF10FFABE300A85891 /* NSString+InflectionSupport.m in Sources */ = {isa = PBXBuildFile; fileRef = 253BBE951076AB1C00C804B2 /* NSString+InflectionSupport.m */; };
|
||||
255DE0F010FFABE500A85891 /* NSDictionary+OTRestRequestSerialization.m in Sources */ = {isa = PBXBuildFile; fileRef = 3F4E1919102DD42F00320118 /* NSDictionary+OTRestRequestSerialization.m */; };
|
||||
255DE0F410FFAC0A00A85891 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 255DE0F310FFAC0A00A85891 /* SystemConfiguration.framework */; };
|
||||
255DE1B110FFB16800A85891 /* OTRestSpecResponseLoader.m in Sources */ = {isa = PBXBuildFile; fileRef = 255DE1B010FFB16800A85891 /* OTRestSpecResponseLoader.m */; };
|
||||
2580B068102E0F1000832D07 /* OTRestModelLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 2580B066102E0F1000832D07 /* OTRestModelLoader.h */; };
|
||||
2580B069102E0F1000832D07 /* OTRestModelLoader.m in Sources */ = {isa = PBXBuildFile; fileRef = 2580B067102E0F1000832D07 /* OTRestModelLoader.m */; };
|
||||
2580B0C7102E1EBC00832D07 /* libElementParser.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3F4E18DB102DD31E00320118 /* libElementParser.a */; };
|
||||
@@ -73,7 +93,6 @@
|
||||
3F6C3A2E10FE749C008F47C5 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3F6C3A2D10FE749C008F47C5 /* Foundation.framework */; };
|
||||
3F6C3A9410FE7519008F47C5 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 3F6C3A9310FE7519008F47C5 /* main.m */; };
|
||||
3F6C3A9610FE7524008F47C5 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3F6C3A9510FE7524008F47C5 /* UIKit.framework */; };
|
||||
3F6C3AD410FE76C1008F47C5 /* OTRestModelMapperSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 3F6C3AD010FE76C1008F47C5 /* OTRestModelMapperSpec.m */; };
|
||||
3FBF1D39103614E500E307AC /* OTRestModelManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 3FBF1D37103614E500E307AC /* OTRestModelManager.h */; };
|
||||
3FBF1D3A103614E500E307AC /* OTRestModelManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 3FBF1D38103614E500E307AC /* OTRestModelManager.m */; };
|
||||
3FCDFA96103A298E00D7CD66 /* OTRestModelMapper.m in Sources */ = {isa = PBXBuildFile; fileRef = 25FCDDDF1035C201005418A7 /* OTRestModelMapper.m */; };
|
||||
@@ -104,6 +123,13 @@
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
255DDF9410FF99F600A85891 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 3F4E18D6102DD31E00320118 /* ElementParser.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = 25FCE09E10360372005418A7 /* Tests.octest */;
|
||||
remoteInfo = Tests;
|
||||
};
|
||||
3F4E18DA102DD31E00320118 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 3F4E18D6102DD31E00320118 /* ElementParser.xcodeproj */;
|
||||
@@ -162,6 +188,15 @@
|
||||
2525F99F106C0FF40069EBED /* OTRestNotifications.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OTRestNotifications.m; sourceTree = "<group>"; };
|
||||
253BBE941076AB1C00C804B2 /* NSString+InflectionSupport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+InflectionSupport.h"; sourceTree = "<group>"; };
|
||||
253BBE951076AB1C00C804B2 /* NSString+InflectionSupport.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+InflectionSupport.m"; sourceTree = "<group>"; };
|
||||
255DE03010FF9BDF00A85891 /* OTRestManagedModelSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OTRestManagedModelSpec.m; sourceTree = "<group>"; };
|
||||
255DE05910FF9DA500A85891 /* OTRestModelManagerSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OTRestModelManagerSpec.m; sourceTree = "<group>"; };
|
||||
255DE05C10FFA05800A85891 /* Human.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Human.h; sourceTree = "<group>"; };
|
||||
255DE05D10FFA05800A85891 /* Human.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Human.m; sourceTree = "<group>"; };
|
||||
255DE0B610FFA52E00A85891 /* Data Model.xcdatamodel */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = wrapper.xcdatamodel; name = "Data Model.xcdatamodel"; path = "Models/Data Model.xcdatamodel"; sourceTree = "<group>"; };
|
||||
255DE0E110FFABA500A85891 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; };
|
||||
255DE0F310FFAC0A00A85891 /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; };
|
||||
255DE1AF10FFB16800A85891 /* OTRestSpecResponseLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OTRestSpecResponseLoader.h; sourceTree = "<group>"; };
|
||||
255DE1B010FFB16800A85891 /* OTRestSpecResponseLoader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OTRestSpecResponseLoader.m; sourceTree = "<group>"; };
|
||||
2580B066102E0F1000832D07 /* OTRestModelLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OTRestModelLoader.h; sourceTree = "<group>"; };
|
||||
2580B067102E0F1000832D07 /* OTRestModelLoader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OTRestModelLoader.m; sourceTree = "<group>"; };
|
||||
25FCDDD91035BC85005418A7 /* OTRestManagedModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OTRestManagedModel.h; sourceTree = "<group>"; };
|
||||
@@ -257,6 +292,8 @@
|
||||
3F6C39DB10FE73FD008F47C5 /* libElementParser.a in Frameworks */,
|
||||
3F6C3A2E10FE749C008F47C5 /* Foundation.framework in Frameworks */,
|
||||
3F6C3A9610FE7524008F47C5 /* UIKit.framework in Frameworks */,
|
||||
255DE0E210FFABA500A85891 /* CoreData.framework in Frameworks */,
|
||||
255DE0F410FFAC0A00A85891 /* SystemConfiguration.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -296,8 +333,6 @@
|
||||
034768DFFF38A50411DB9C8B /* Products */,
|
||||
3F262088103A0AFF00B75C94 /* Tests-Info.plist */,
|
||||
3F6C39A710FE5C95008F47C5 /* UI Spec-Info.plist */,
|
||||
3F6C3A2D10FE749C008F47C5 /* Foundation.framework */,
|
||||
3F6C3A9510FE7524008F47C5 /* UIKit.framework */,
|
||||
);
|
||||
name = OTRestFramework;
|
||||
sourceTree = "<group>";
|
||||
@@ -305,11 +340,33 @@
|
||||
0867D69AFE84028FC02AAC07 /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
3F6C3A9510FE7524008F47C5 /* UIKit.framework */,
|
||||
3F6C3A2D10FE749C008F47C5 /* Foundation.framework */,
|
||||
AACBBE490F95108600F1A2B1 /* Foundation.framework */,
|
||||
255DE0E110FFABA500A85891 /* CoreData.framework */,
|
||||
255DE0F310FFAC0A00A85891 /* SystemConfiguration.framework */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
255DE05B10FFA04200A85891 /* Models */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
255DE05C10FFA05800A85891 /* Human.h */,
|
||||
255DE05D10FFA05800A85891 /* Human.m */,
|
||||
);
|
||||
path = Models;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
255DE0A110FFA43A00A85891 /* Support */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
255DE1AF10FFB16800A85891 /* OTRestSpecResponseLoader.h */,
|
||||
255DE1B010FFB16800A85891 /* OTRestSpecResponseLoader.m */,
|
||||
);
|
||||
path = Support;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
2580B1AA102F72D700832D07 /* Dependencies */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@@ -390,6 +447,7 @@
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
3F4E18DB102DD31E00320118 /* libElementParser.a */,
|
||||
255DDF9510FF99F600A85891 /* Tests.octest */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
@@ -431,18 +489,15 @@
|
||||
3F6C3A9210FE750E008F47C5 /* Specs */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
3F6C3ACC10FE76C1008F47C5 /* Models */,
|
||||
3F6C3A9310FE7519008F47C5 /* main.m */,
|
||||
);
|
||||
name = Specs;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
3F6C3ACC10FE76C1008F47C5 /* Models */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
255DE0A110FFA43A00A85891 /* Support */,
|
||||
255DE05B10FFA04200A85891 /* Models */,
|
||||
3F6C3AD010FE76C1008F47C5 /* OTRestModelMapperSpec.m */,
|
||||
255DE03010FF9BDF00A85891 /* OTRestManagedModelSpec.m */,
|
||||
255DE05910FF9DA500A85891 /* OTRestModelManagerSpec.m */,
|
||||
3F6C3A9310FE7519008F47C5 /* main.m */,
|
||||
255DE0B610FFA52E00A85891 /* Data Model.xcdatamodel */,
|
||||
);
|
||||
path = Models;
|
||||
path = Specs;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
3FCDFAAC103A460100D7CD66 /* Test Classes */ = {
|
||||
@@ -618,6 +673,13 @@
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXReferenceProxy section */
|
||||
255DDF9510FF99F600A85891 /* Tests.octest */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = wrapper.cfbundle;
|
||||
path = Tests.octest;
|
||||
remoteRef = 255DDF9410FF99F600A85891 /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
3F4E18DB102DD31E00320118 /* libElementParser.a */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = archive.ar;
|
||||
@@ -705,7 +767,6 @@
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
3F6C3A9410FE7519008F47C5 /* main.m in Sources */,
|
||||
3F6C3AD410FE76C1008F47C5 /* OTRestModelMapperSpec.m in Sources */,
|
||||
3F035C7C10FE7F0100C469B4 /* OTRestModelMapper.m in Sources */,
|
||||
3F035C8110FE7F1A00C469B4 /* SBJsonWriter.m in Sources */,
|
||||
3F035C8210FE7F1B00C469B4 /* SBJsonParser.m in Sources */,
|
||||
@@ -715,6 +776,24 @@
|
||||
3F035C8610FE7F1E00C469B4 /* NSObject+SBJSON.m in Sources */,
|
||||
3F035D0A10FE829B00C469B4 /* TestSerializationAssociation.m in Sources */,
|
||||
3F035D0B10FE82A000C469B4 /* TestSerialization.m in Sources */,
|
||||
255DE05A10FF9DA500A85891 /* OTRestModelManagerSpec.m in Sources */,
|
||||
255DE05E10FFA05800A85891 /* Human.m in Sources */,
|
||||
255DE0B710FFA52E00A85891 /* Data Model.xcdatamodel in Sources */,
|
||||
255DE0DB10FFAB7700A85891 /* OTRestModelManager.m in Sources */,
|
||||
255DE0DC10FFAB7B00A85891 /* OTRestModelLoader.m in Sources */,
|
||||
255DE0DD10FFAB7E00A85891 /* OTRestManagedObjectStore.m in Sources */,
|
||||
255DE0DE10FFAB7F00A85891 /* OTRestManagedModel.m in Sources */,
|
||||
255DE0E510FFABBB00A85891 /* OTRestResponse.m in Sources */,
|
||||
255DE0E610FFABBC00A85891 /* OTRestRequest.m in Sources */,
|
||||
255DE0E710FFABBD00A85891 /* OTRestParamsFileAttachment.m in Sources */,
|
||||
255DE0E810FFABBE00A85891 /* OTRestParamsDataAttachment.m in Sources */,
|
||||
255DE0E910FFABC100A85891 /* OTRestParamsAttachment.m in Sources */,
|
||||
255DE0EA10FFABC300A85891 /* OTRestParams.m in Sources */,
|
||||
255DE0EB10FFABC600A85891 /* OTRestNotifications.m in Sources */,
|
||||
255DE0EE10FFABDD00A85891 /* OTRestClient.m in Sources */,
|
||||
255DE0EF10FFABE300A85891 /* NSString+InflectionSupport.m in Sources */,
|
||||
255DE0F010FFABE500A85891 /* NSDictionary+OTRestRequestSerialization.m in Sources */,
|
||||
255DE1B110FFB16800A85891 /* OTRestSpecResponseLoader.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
+ (id)newObject;
|
||||
|
||||
/**
|
||||
* The primaryKey property mapping, defaults to @"ID"
|
||||
* The primaryKey property mapping, defaults to @"railsID"
|
||||
*/
|
||||
+ (NSString*)primaryKey;
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@
|
||||
}
|
||||
|
||||
+ (NSString*)primaryKey {
|
||||
return @"ID";
|
||||
return @"railsID";
|
||||
}
|
||||
|
||||
+ (NSString*)primaryKeyElement {
|
||||
|
||||
BIN
Specs/Models/Data Model.xcdatamodel/elements
Normal file
BIN
Specs/Models/Data Model.xcdatamodel/elements
Normal file
Binary file not shown.
BIN
Specs/Models/Data Model.xcdatamodel/layout
Normal file
BIN
Specs/Models/Data Model.xcdatamodel/layout
Normal file
Binary file not shown.
24
Specs/Models/Human.h
Normal file
24
Specs/Models/Human.h
Normal file
@@ -0,0 +1,24 @@
|
||||
//
|
||||
// Human.h
|
||||
// OTRestFramework
|
||||
//
|
||||
// Created by Blake Watters on 1/14/10.
|
||||
// Copyright 2010 Objective 3. All rights reserved.
|
||||
//
|
||||
|
||||
#import "OTRestManagedModel.h"
|
||||
|
||||
|
||||
@interface Human : OTRestManagedModel {
|
||||
}
|
||||
|
||||
@property (nonatomic, retain) NSNumber* railsID;
|
||||
@property (nonatomic, retain) NSString* name;
|
||||
@property (nonatomic, retain) NSString* nickName;
|
||||
@property (nonatomic, retain) NSDate* birthday;
|
||||
@property (nonatomic, retain) NSString* sex;
|
||||
@property (nonatomic, retain) NSNumber* age;
|
||||
@property (nonatomic, retain) NSDate* createdAt;
|
||||
@property (nonatomic, retain) NSDate* updatedAt;
|
||||
|
||||
@end
|
||||
34
Specs/Models/Human.m
Normal file
34
Specs/Models/Human.m
Normal file
@@ -0,0 +1,34 @@
|
||||
//
|
||||
// Human.m
|
||||
// OTRestFramework
|
||||
//
|
||||
// Created by Blake Watters on 1/14/10.
|
||||
// Copyright 2010 Objective 3. All rights reserved.
|
||||
//
|
||||
|
||||
#import "Human.h"
|
||||
|
||||
@implementation Human
|
||||
|
||||
@dynamic railsID;
|
||||
@dynamic name;
|
||||
@dynamic nickName;
|
||||
@dynamic birthday;
|
||||
@dynamic sex;
|
||||
@dynamic age;
|
||||
@dynamic createdAt;
|
||||
@dynamic updatedAt;
|
||||
|
||||
+ (NSDictionary*)elementToPropertyMappings {
|
||||
return [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
@"name", @"name",
|
||||
@"nickName", @"nick-name",
|
||||
@"birthday", @"birthday",
|
||||
@"sex", @"sex",
|
||||
@"age", @"age",
|
||||
@"createdAt", @"created-at",
|
||||
@"updatedAt", @"updated-at",
|
||||
nil];
|
||||
}
|
||||
|
||||
@end
|
||||
24
Specs/OTRestManagedModelSpec.m
Normal file
24
Specs/OTRestManagedModelSpec.m
Normal file
@@ -0,0 +1,24 @@
|
||||
//
|
||||
// OTRestManagedModelSpec.m
|
||||
// OTRestFramework
|
||||
//
|
||||
// Created by Blake Watters on 1/14/10.
|
||||
// Copyright 2010 Objective 3. All rights reserved.
|
||||
//
|
||||
|
||||
|
||||
#import "UISpec.h"
|
||||
#import "dsl/UIExpectation.h"
|
||||
|
||||
#import "OTRestModelManager.h"
|
||||
#import "Human.h"
|
||||
|
||||
@interface OTRestManagedModelSpec : NSObject <UISpec> {
|
||||
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation OTRestManagedModelSpec
|
||||
|
||||
@end
|
||||
54
Specs/OTRestModelManagerSpec.m
Normal file
54
Specs/OTRestModelManagerSpec.m
Normal file
@@ -0,0 +1,54 @@
|
||||
//
|
||||
// OTRestModelManagerSpec.m
|
||||
// OTRestFramework
|
||||
//
|
||||
// Created by Blake Watters on 1/14/10.
|
||||
// Copyright 2010 Objective 3. All rights reserved.
|
||||
//
|
||||
|
||||
#import "UISpec.h"
|
||||
#import "dsl/UIExpectation.h"
|
||||
|
||||
#import "OTRestModelManager.h"
|
||||
#import "OTRestSpecResponseLoader.h"
|
||||
#import "Human.h"
|
||||
|
||||
|
||||
@interface OTRestModelManagerSpec : NSObject <UISpec> {
|
||||
OTRestModelManager* _modelManager;
|
||||
OTRestSpecResponseLoader* _responseLoader;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation OTRestModelManagerSpec
|
||||
|
||||
- (void)beforeAll {
|
||||
_modelManager = [OTRestModelManager managerWithBaseURL:@"http://10.4.5.213:3000"];
|
||||
_modelManager.objectStore = [[OTRestManagedObjectStore alloc] initWithStoreFilename:@"OTRest_Specs.sqlite"];
|
||||
[_modelManager registerModel:[Human class] forElementNamed:@"human"];
|
||||
// TODO: Set the accept header...
|
||||
|
||||
_responseLoader = [[OTRestSpecResponseLoader alloc] init];
|
||||
}
|
||||
|
||||
- (void)itShouldLoadAHuman {
|
||||
NSLog(@"Model Manager: %@", _modelManager);
|
||||
NSLog(@"Response Loader: %@", _responseLoader);
|
||||
OTRestRequest* request = [_modelManager loadModel:@"/humans/1.xml" delegate:_responseLoader callback:@selector(loadResponse:)];
|
||||
NSLog(@"Request: %@", request);
|
||||
[_responseLoader waitForResponse];
|
||||
Human* blake = (Human*) _responseLoader.response;
|
||||
[expectThat(blake.name) should:be(@"Blake Watters")];
|
||||
}
|
||||
|
||||
- (void)itShouldLoadAllHumans {
|
||||
}
|
||||
|
||||
- (void)itShouldLoadHumansInPages {
|
||||
}
|
||||
|
||||
- (void)itShouldHandleConnectionFailures {
|
||||
}
|
||||
|
||||
@end
|
||||
24
Specs/Support/OTRestSpecResponseLoader.h
Normal file
24
Specs/Support/OTRestSpecResponseLoader.h
Normal file
@@ -0,0 +1,24 @@
|
||||
//
|
||||
// OTRestSpecResponseLoader.h
|
||||
// OTRestFramework
|
||||
//
|
||||
// Created by Blake Watters on 1/14/10.
|
||||
// Copyright 2010 Objective 3. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
|
||||
@interface OTRestSpecResponseLoader : NSObject {
|
||||
BOOL _awaitingResponse;
|
||||
id _response;
|
||||
}
|
||||
|
||||
// The object that was loaded from the web request
|
||||
@property (nonatomic, readonly) id response;
|
||||
|
||||
// Wait for a response to load
|
||||
- (void)waitForResponse;
|
||||
- (void)loadResponse:(id)response;
|
||||
|
||||
@end
|
||||
35
Specs/Support/OTRestSpecResponseLoader.m
Normal file
35
Specs/Support/OTRestSpecResponseLoader.m
Normal file
@@ -0,0 +1,35 @@
|
||||
//
|
||||
// OTRestSpecResponseLoader.m
|
||||
// OTRestFramework
|
||||
//
|
||||
// Created by Blake Watters on 1/14/10.
|
||||
// Copyright 2010 Objective 3. All rights reserved.
|
||||
//
|
||||
|
||||
#import "OTRestSpecResponseLoader.h"
|
||||
|
||||
|
||||
@implementation OTRestSpecResponseLoader
|
||||
|
||||
@synthesize response = _response;
|
||||
|
||||
- (void)dealloc {
|
||||
[_response release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (void)waitForResponse {
|
||||
_awaitingResponse = YES;
|
||||
while (_awaitingResponse == YES) {
|
||||
[[NSRunLoop currentRunLoop] runUntilDate:
|
||||
[NSDate dateWithTimeIntervalSinceNow:1.0]];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)loadResponse:(id)response {
|
||||
NSLog(@"The response: %@", response);
|
||||
_response = [response retain];
|
||||
_awaitingResponse = NO;
|
||||
}
|
||||
|
||||
@end
|
||||
1
Specs/otrestspecs_rails
Submodule
1
Specs/otrestspecs_rails
Submodule
Submodule Specs/otrestspecs_rails added at a04e431080
Reference in New Issue
Block a user