mirror of
https://github.com/zhigang1992/RestKit.git
synced 2026-04-11 19:47:56 +08:00
48 lines
1.1 KiB
Objective-C
48 lines
1.1 KiB
Objective-C
//
|
|
// RKObjectSpec.m
|
|
// RestKit
|
|
//
|
|
// Created by Blake Watters on 7/21/10.
|
|
// Copyright 2010 Two Toasters. All rights reserved.
|
|
//
|
|
|
|
#import "RKSpecEnvironment.h"
|
|
#import "RKObject.h"
|
|
#import "NSDictionary+RKRequestSerialization.h"
|
|
#import "NSDictionary+RKAdditions.h"
|
|
|
|
@interface RKObjectSpec : RKObject <UISpec> {
|
|
NSString* _favoriteColor;
|
|
NSNumber* _age;
|
|
}
|
|
|
|
@property (nonatomic, retain) NSString* favoriteColor;
|
|
@property (nonatomic, retain) NSNumber* age;
|
|
|
|
@end
|
|
|
|
@implementation RKObjectSpec
|
|
|
|
@synthesize favoriteColor = _favoriteColor;
|
|
@synthesize age = _age;
|
|
|
|
+ (NSDictionary*)elementToPropertyMappings {
|
|
return [NSDictionary dictionaryWithKeysAndObjects:
|
|
@"myFavoriteColor", @"favoriteColor",
|
|
@"myAge", @"age",
|
|
nil];
|
|
}
|
|
|
|
- (void)itShouldReturnTheColorPropertiesForSerialization {
|
|
self.age = [NSNumber numberWithInt:10];
|
|
self.favoriteColor = @"blue";
|
|
|
|
NSDictionary* expectedParams = [NSDictionary dictionaryWithKeysAndObjects:
|
|
@"myFavoriteColor", @"blue",
|
|
@"myAge", [NSNumber numberWithInt:10],
|
|
nil];
|
|
[expectThat([self propertiesForSerialization]) should:be(expectedParams)];
|
|
}
|
|
|
|
@end
|