Skip to content

Commit c088cfa

Browse files
committed
Merge branch 'update-travis-xcode-9'
2 parents 906f3f7 + 6bf1982 commit c088cfa

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

OHHTTPStubs/UnitTests/Test Suites/NSURLSessionTests.m

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -296,20 +296,20 @@ - (void)test_NSURLSessionDefaultConfig_notFollowingRedirects
296296
**/
297297
- (void)test_NSURLSessionDefaultConfig_MethodAndDataRetentionOnRedirect
298298
{
299-
NSURLSessionTestDelegate* delegate = [NSURLSessionTestDelegate delegateFollowingRedirects:YES fulfillOnCompletion:nil];
300-
301299
if ([NSURLSessionConfiguration class] && [NSURLSession class])
302300
{
303-
NSURLSessionConfiguration* config = [NSURLSessionConfiguration defaultSessionConfiguration];
304-
NSURLSession *session = [NSURLSession sessionWithConfiguration:config delegate:delegate delegateQueue:nil];
305-
306301
NSDictionary* json = @{ @"query": @"Hello World" };
307302
NSArray<NSString*>* allMethods = @[@"GET", @"HEAD", @"POST", @"PATCH", @"PUT"];
308303

309304
/** 301, 302, 307, 308: GET, HEAD, POST, PATCH, PUT should all maintain HTTP method and body unchanged **/
310305
for (NSNumber* redirectStatusCode in @[@301, @302, @307, @308]) {
311306
int statusCode = redirectStatusCode.intValue;
312307
for (NSString* method in allMethods) {
308+
309+
NSURLSessionConfiguration* config = [NSURLSessionConfiguration defaultSessionConfiguration];
310+
NSURLSessionTestDelegate* delegate = [NSURLSessionTestDelegate delegateFollowingRedirects:YES fulfillOnCompletion:nil];
311+
NSURLSession *session = [NSURLSession sessionWithConfiguration:config delegate:delegate delegateQueue:nil];
312+
313313
[self _test_redirect_NSURLSession:session httpMethod:method jsonBody:json delays:0.0 redirectStatusCode:statusCode
314314
completion:^(NSString *redirectedRequestMethod, id redirectedRequestJSONBody, NSHTTPURLResponse *redirectHTTPResponse, id finalJSONResponse, NSError *errorResponse)
315315
{
@@ -323,11 +323,18 @@ - (void)test_NSURLSessionDefaultConfig_MethodAndDataRetentionOnRedirect
323323
@"Unexpected JSON response received after %d redirect", statusCode);
324324
XCTAssertNil(errorResponse, @"Unexpected error during %d redirect", statusCode);
325325
}];
326+
327+
[session finishTasksAndInvalidate];
326328
}
327329
}
328330

329331
/** 303: GET, HEAD, POST, PATCH, PUT should use a GET HTTP method after redirection and not forward the body **/
330332
for (NSString* method in allMethods) {
333+
334+
NSURLSessionConfiguration* config = [NSURLSessionConfiguration defaultSessionConfiguration];
335+
NSURLSessionTestDelegate* delegate = [NSURLSessionTestDelegate delegateFollowingRedirects:YES fulfillOnCompletion:nil];
336+
NSURLSession *session = [NSURLSession sessionWithConfiguration:config delegate:delegate delegateQueue:nil];
337+
331338
[self _test_redirect_NSURLSession:session httpMethod:method jsonBody:json delays:0.0 redirectStatusCode:303
332339
completion:^(NSString *redirectedRequestMethod, id redirectedRequestJSONBody, NSHTTPURLResponse *redirectHTTPResponse, id finalJSONResponse, NSError *errorResponse)
333340
{
@@ -337,9 +344,9 @@ - (void)test_NSURLSessionDefaultConfig_MethodAndDataRetentionOnRedirect
337344
XCTAssertEqualObjects(finalJSONResponse, @{ @"RequestBody": json }, @"Unexpected JSON response received after 303 redirect");
338345
XCTAssertNil(errorResponse, @"Unexpected error during 303 redirect");
339346
}];
340-
}
341347

342-
[session finishTasksAndInvalidate];
348+
[session finishTasksAndInvalidate];
349+
}
343350
}
344351
else
345352
{

Rakefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
desc 'Build an iOS scheme'
44
task :ios, [:scheme, :ios_version, :action, :additional_args] do |_,args|
5-
destination = "name=iPhone 5,OS=#{args.ios_version}"
5+
destination = "name=iPhone 7,OS=#{args.ios_version}"
66
build("OHHTTPStubs #{args.scheme}", "iphonesimulator", destination, args.action, args.additional_args)
77
end
88

@@ -14,7 +14,7 @@ end
1414

1515
desc 'Build a tvOS scheme'
1616
task :tvos, [:scheme, :tvos_version, :action, :additional_args] do |_,args|
17-
destination = "name=Apple TV 1080p,OS=#{args.tvos_version}"
17+
destination = "name=Apple TV,OS=#{args.tvos_version}"
1818
build("OHHTTPStubs #{args.scheme}", "appletvsimulator", destination, args.action, args.additional_args)
1919
end
2020

0 commit comments

Comments
 (0)