 
     func testAuthorizedWhenInUseWhenAuthorizedWhenInUse() {
         CLLocationManagerMock._authorizationStatus = .AuthorizedWhenInUse
-        let mock = CLLocationManagerMock()
-        let locationManager = LocationManagerUT(clLocationManager: mock)
-        let expectation = expectationWithDescription("onSuccess fulfilled for future")
-        let future = locationManager.authorize(.AuthorizedWhenInUse)
-        future.onSuccess {
-            XCTAssertFalse(mock.requestWhenInUseAuthorizationCalled, "requestWhenInUseAuthorization called")
+        let expectation = expectationWithDescription("onSuccess fulfilled for future")
+        let future = self.locationManager.authorize(.AuthorizedWhenInUse)
+        future.onSuccess {
+            XCTAssertFalse(self.mock.requestWhenInUseAuthorizationCalled, "requestWhenInUseAuthorization called")
             expectation.fulfill()
         }
         future.onFailure{error in


    func testAuthorizedAlwaysSuccess() {
        CLLocationManagerMock._authorizationStatus = .NotDetermined
        let mock = CLLocationManagerMock()
        let locationManager = LocationManagerUT(clLocationManager: mock)
        let expectation = expectationWithDescription("onSuccess fulfilled for future")
        let future = locationManager.authorize(.AuthorizedAlways)
        future.onSuccess {
            XCTAssert(mock.requestAlwaysAuthorizationCalled, "requestAlwaysAuthorization not called")
            expectation.fulfill()
        }
        future.onFailure{error in
            XCTAssert(false, "onFailure called")
        }
        locationManager.didChangeAuthorizationStatus(.AuthorizedAlways)
        waitForExpectationsWithTimeout(2) {error in
            XCTAssertNil(error, "\(error)")
        }

    
    func testAuthorizedWhenInUseFailure() {
        CLLocationManagerMock._authorizationStatus = .NotDetermined
        let expectation = expectationWithDescription("onFailure fulfilled for future")
        let future = self.locationManager.authorize(.AuthorizedWhenInUse)
        future.onSuccess {
            XCTAssert(false, "onSuccess called")
        }
        future.onFailure{error in
            XCTAssert(self.mock.requestWhenInUseAuthorizationCalled, "requestWhenInUseAuthorization not called")
            XCTAssert(error.code == LocationError.AuthorisedWhenInUseFailed.rawValue, "Error code invalid")
            expectation.fulfill()
        }
