File tree Expand file tree Collapse file tree 1 file changed +13
-7
lines changed
Expand file tree Collapse file tree 1 file changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -21,18 +21,24 @@ - (void)testValidCallToMarvel_ShouldGetHTTPStatusCode200
2121 NSURL *validQueryURL = [NSURL URLWithString:
2222 [validQueryMissingAuthentication stringByAppendingString: [authentication URLParameters ]]];
2323
24+ __block NSHTTPURLResponse *httpResponse;
25+ [self startGETRequestToURL: validQueryURL
26+ withCompletionHandler: ^(NSData *data, NSURLResponse *response, NSError *error) {
27+ httpResponse = (NSHTTPURLResponse *)response;
28+ }];
29+
30+ assertThatAfter (5 , futureValueOf (@(httpResponse.statusCode )), is (@200 ));
31+ }
32+
33+ - (void )startGETRequestToURL : (NSURL *)url
34+ withCompletionHandler : (void (^)(NSData *, NSURLResponse *, NSError *))completionHandler
35+ {
2436 NSURLSessionConfiguration *sessionConfig = [NSURLSessionConfiguration defaultSessionConfiguration ];
2537 NSURLSession *session = [NSURLSession sessionWithConfiguration: sessionConfig
2638 delegate: nil
2739 delegateQueue: nil ];
28- __block NSHTTPURLResponse *httpResponse;
29- NSURLSessionDataTask *dataTask = [session dataTaskWithURL: validQueryURL
30- completionHandler: ^(NSData *data, NSURLResponse *response, NSError *error) {
31- httpResponse = (NSHTTPURLResponse *)response;
32- }];
40+ NSURLSessionDataTask *dataTask = [session dataTaskWithURL: url completionHandler: completionHandler];
3341 [dataTask resume ];
34-
35- assertThatAfter (5 , futureValueOf (@(httpResponse.statusCode )), is (@200 ));
3642}
3743
3844@end
You can’t perform that action at this time.
0 commit comments