Permalink
Browse files

Added additional tests to explore behaviors for proposed patch in pul…

…l request. refs #578
  • Loading branch information...
1 parent 6c76546 commit 20aa05573ce74f1202936f7edffbeabd564a4abd @blakewatters blakewatters committed Mar 21, 2012
Showing with 21 additions and 0 deletions.
  1. +21 −0 Tests/Logic/Network/RKURLTest.m
@@ -181,4 +181,25 @@ - (void)testShouldProperlyHandleLongURLParameterValues {
assertThat([URL absoluteString], is(equalTo([NSString stringWithFormat:@"%@/%@", [RKTestFactory baseURLString], longResourcePath])));
}
+- (void)testThatPathIsPreservedWhenURLIsConstructedFromAnotherRKURL
+{
+ RKURL *URL = [RKURL URLWithBaseURL:[RKTestFactory baseURL] resourcePath:@"/this/and/that"];
+ RKURL *newURL = [URL URLByAppendingResourcePath:@"/the/other/thing" queryParameters:[NSDictionary dictionaryWithObject:@"up" forKey:@"word"]];
+ assertThat([newURL absoluteString], is(equalTo(@"http://127.0.0.1:4567/this/and/that/the/other/thing?word=up")));
+}
+
+- (void)testThatResourcePathIsPreservedWhenURLIsConstructedFromAnotherRKURL
+{
+ RKURL *URL = [RKURL URLWithBaseURL:[RKTestFactory baseURL] resourcePath:@"/this/and/that"];
+ RKURL *newURL = [URL URLByAppendingResourcePath:@"/the/other/thing" queryParameters:[NSDictionary dictionaryWithObject:@"up" forKey:@"word"]];
+ assertThat([newURL resourcePath], is(equalTo(@"/the/other/thing")));
+}
+
+- (void)testThatPathAndQueryParamsArePreservedWhenURLIsConstructedFromAnotherRKURL
+{
+ RKURL *URL = [RKURL URLWithBaseURL:[RKTestFactory baseURL] resourcePath:@"/this/and/that" queryParameters:[NSDictionary dictionaryWithObject:@"who" forKey:@"where"]];
+ RKURL *newURL = [URL URLByAppendingResourcePath:@"/the/other/thing" queryParameters:[NSDictionary dictionaryWithObject:@"up" forKey:@"word"]];
+ assertThat([newURL absoluteString], is(equalTo(@"http://127.0.0.1:4567/this/and/that/the/other/thing?where=who&word=up")));
+}
+
@end

0 comments on commit 20aa055

Please sign in to comment.