mirror of
https://github.com/zhigang1992/RestKit.git
synced 2026-06-13 01:28:56 +08:00
36 lines
919 B
Objective-C
36 lines
919 B
Objective-C
//
|
|
// RKURLSpec.m
|
|
// RestKit
|
|
//
|
|
// Created by Blake Watters on 6/29/11.
|
|
// Copyright 2011 Two Toasters. All rights reserved.
|
|
//
|
|
|
|
#import "RKSpecEnvironment.h"
|
|
#import "RKURL.h"
|
|
|
|
@interface RKURLSpec : RKSpec
|
|
@end
|
|
|
|
@implementation RKURLSpec
|
|
|
|
- (void)itShouldNotExplodeBecauseOfUnicodeCharacters {
|
|
NSException* failed = nil;
|
|
@try {
|
|
[RKURL URLWithBaseURLString:@"http://test.com" resourcePath:@"/places.json?category=Automóviles"];
|
|
}
|
|
@catch (NSException *exception) {
|
|
failed = exception;
|
|
}
|
|
@finally {
|
|
NSAssert((failed == nil), @"No exception should be generated by creating URL with Unicode chars");
|
|
}
|
|
}
|
|
|
|
- (void)itShouldEncodePlusCharacters {
|
|
RKURL* URL = [RKURL URLWithBaseURLString:@"http://restkit.org" resourcePath:@"/john+restkit@gmail.com"];
|
|
assertThat([URL absoluteString], is(equalTo(@"http://restkit.org/john%2Brestkit@gmail.com")));
|
|
}
|
|
|
|
@end
|
|
|