mirror of
https://github.com/zhigang1992/RestKit.git
synced 2026-05-08 18:02:43 +08:00
47 lines
1.1 KiB
Objective-C
47 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"
|
|
|
|
@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)itShouldReturnTheColorParamsForSerialization {
|
|
self.age = [NSNumber numberWithInt:10];
|
|
self.favoriteColor = @"blue";
|
|
|
|
NSDictionary* expectedParams = [NSDictionary dictionaryWithKeysAndObjects:
|
|
@"myFavoriteColor", @"blue",
|
|
@"myAge", [NSNumber numberWithInt:10],
|
|
nil];
|
|
[expectThat([self paramsForSerialization]) should:be(expectedParams)];
|
|
}
|
|
|
|
@end
|