Skip to content

Commit

Permalink
Merge branch 'master' into separate-demo
Browse files Browse the repository at this point in the history
  • Loading branch information
8W9aG committed Feb 2, 2016
2 parents 9f537f0 + 4e2bd2b commit fce738f
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 0 deletions.
5 changes: 5 additions & 0 deletions SPTDataLoader/SPTDataLoaderRequest.m
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,11 @@ + (NSString *)languageHeaderValue
return languageHeaderValue;
}

- (NSString *)debugDescription
{
return [NSString stringWithFormat:@"%@ { URL: %@ }", [super debugDescription], self.URL];
}

#pragma mark NSCopying

- (id)copyWithZone:(NSZone *)zone
Expand Down
6 changes: 6 additions & 0 deletions SPTDataLoader/SPTDataLoaderResponse.m
Original file line number Diff line number Diff line change
Expand Up @@ -181,4 +181,10 @@ - (NSDate *)retryAfterForHeaders:(NSDictionary *)headers
return [httpDateFormatter dateFromString:retryAfterValue];
}

- (NSString *)debugDescription
{
return [NSString stringWithFormat:@"%@ { URL: %@ } { status code: %ld, headers: %@ }", [super debugDescription], self.response.URL, (long)self.statusCode, self.responseHeaders];
}


@end
10 changes: 10 additions & 0 deletions SPTDataLoaderTests/SPTDataLoaderRequestTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -161,4 +161,14 @@ - (void)testAcceptLanguageWithNoEnglishLanguages
XCTAssertEqualObjects(@"fr-CA, pt-PT;q=0.50, en;q=0.01", languageValues);
}

- (void)testDebugDescription
{
XCTAssertNotNil(self.request.debugDescription,
@"The debugDescription shouldn't be nil.");

NSString *URLString = [NSString stringWithFormat:@"URL: %@", self.URL.absoluteString];
XCTAssertTrue([self.request.debugDescription containsString:URLString],
@"The debugDescription should contain the URL of the request.");
}

@end
19 changes: 19 additions & 0 deletions SPTDataLoaderTests/SPTDataLoaderResponseTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -184,4 +184,23 @@ - (void)testShouldNotRetryForCancelled
XCTAssertFalse(shouldRetry, @"The response should not retry when the connection was cancelled");
}

- (void)testDebugDescription
{
XCTAssertNotNil(self.response.debugDescription,
@"The debugDescription shouldn't be nil.");

NSString *URLString = [NSString stringWithFormat:@"URL: %@", self.urlResponse.URL];
XCTAssertTrue([self.response.debugDescription containsString:URLString],
@"The debugDescription should contain the URL of the response");

NSString *statusCodeString = [NSString stringWithFormat:@"status code: %ld", (long)self.response.statusCode];
XCTAssertTrue([self.response.debugDescription containsString:statusCodeString],
@"The debugDescription should contain the status code of the response");

NSString *headersString = [NSString stringWithFormat:@"headers: %@", self.response.responseHeaders];
XCTAssertTrue([self.response.debugDescription containsString:headersString],
@"The debugDescription should contain the headers code of the response");
}


@end

0 comments on commit fce738f

Please sign in to comment.