Permalink
Browse files

Add cast to int to failureError.code so this test works on both the i…

…OS and Mac OS X frameworks.
  • Loading branch information...
1 parent e3264a7 commit f9dd0e99990a1f73fc1bd7f87fa9e0da8b4b9d5c @bmorton bmorton committed with blakewatters Jan 12, 2012
Showing with 15 additions and 0 deletions.
  1. +15 −0 Specs/Network/RKRequestSpec.m
@@ -86,6 +86,21 @@ - (void)testShouldSetURLRequestHTTPBodyByString {
assertThat(request.HTTPBodyString, equalTo(JSON));
}
+- (void)testShouldTimeoutAtInterval {
+ RKSpecResponseLoader* loader = [RKSpecResponseLoader responseLoader];
+ id loaderMock = [OCMockObject partialMockForObject:loader];
+ NSString* url = [NSString stringWithFormat:@"%@/timeout", RKSpecGetBaseURL()];
+ NSURL* URL = [NSURL URLWithString:url];
+ RKRequest* request = [[RKRequest alloc] initWithURL:URL];
+ request.delegate = loaderMock;
+ request.timeoutInterval = 3.0;
+ [[[loaderMock expect] andForwardToRealObject] request:request didFailLoadWithError:OCMOCK_ANY];
+ [request sendAsynchronously];
+ [loaderMock waitForResponse];
+ assertThatInt((int)loader.failureError.code, equalToInt(RKRequestConnectionTimeoutError));
+ [request release];
+}
+
#pragma mark - Background Policies
#if TARGET_OS_IPHONE

0 comments on commit f9dd0e9

Please sign in to comment.