Browse Source

Fixed an expectation order issue in the redirect tests.

Christian Noon 10 years ago
parent
commit
264e29ca83
1 changed files with 4 additions and 2 deletions
  1. 4 2
      Tests/ResponseTests.swift

+ 4 - 2
Tests/ResponseTests.swift

@@ -82,13 +82,14 @@ class AlamofireRedirectResponseTestCase: XCTestCase {
 
 
         Alamofire.request(.GET, URL)
         Alamofire.request(.GET, URL)
             .response { (request, response, data, error) in
             .response { (request, response, data, error) in
-                expectation.fulfill()
                 XCTAssertNotNil(request, "request should not be nil")
                 XCTAssertNotNil(request, "request should not be nil")
                 XCTAssertNotNil(response, "response should not be nil")
                 XCTAssertNotNil(response, "response should not be nil")
                 XCTAssertNotNil(data, "data should not be nil")
                 XCTAssertNotNil(data, "data should not be nil")
                 XCTAssertNil(error, "error should be nil")
                 XCTAssertNil(error, "error should be nil")
 
 
                 XCTAssertEqual(response!.URL!, NSURL(string: "http://www.google.com/")!, "request should have followed a redirect")
                 XCTAssertEqual(response!.URL!, NSURL(string: "http://www.google.com/")!, "request should have followed a redirect")
+
+                expectation.fulfill()
         }
         }
 
 
         waitForExpectationsWithTimeout(10) { (error) in
         waitForExpectationsWithTimeout(10) { (error) in
@@ -111,13 +112,14 @@ class AlamofireRedirectResponseTestCase: XCTestCase {
 
 
         Alamofire.request(.GET, URL)
         Alamofire.request(.GET, URL)
             .response { request, response, data, error in
             .response { request, response, data, error in
-                expectation.fulfill()
                 XCTAssertNotNil(request, "request should not be nil")
                 XCTAssertNotNil(request, "request should not be nil")
                 XCTAssertNotNil(response, "response should not be nil")
                 XCTAssertNotNil(response, "response should not be nil")
                 XCTAssertNotNil(data, "data should not be nil")
                 XCTAssertNotNil(data, "data should not be nil")
                 XCTAssertNil(error, "error should be nil")
                 XCTAssertNil(error, "error should be nil")
 
 
                 XCTAssertEqual(response!.URL!, NSURL(string: URL)!, "request should not have followed a redirect")
                 XCTAssertEqual(response!.URL!, NSURL(string: URL)!, "request should not have followed a redirect")
+
+                expectation.fulfill()
         }
         }
 
 
         waitForExpectationsWithTimeout(10) { (error) in
         waitForExpectationsWithTimeout(10) { (error) in