diff options
Diffstat (limited to 'SmartDeviceLinkTests/DevAPISpecs/SDLAsynchronousRPCRequestOperationSpec.m')
-rw-r--r-- | SmartDeviceLinkTests/DevAPISpecs/SDLAsynchronousRPCRequestOperationSpec.m | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLAsynchronousRPCRequestOperationSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLAsynchronousRPCRequestOperationSpec.m index 7cec8f3e5..9a80d5fd4 100644 --- a/SmartDeviceLinkTests/DevAPISpecs/SDLAsynchronousRPCRequestOperationSpec.m +++ b/SmartDeviceLinkTests/DevAPISpecs/SDLAsynchronousRPCRequestOperationSpec.m @@ -45,21 +45,21 @@ describe(@"sending asynchronous requests", ^{ }); it(@"should correctly send all requests", ^{ - testOperation = [[SDLAsynchronousRPCRequestOperation alloc] initWithConnectionManager:testConnectionManager requests:sendRequests.copy progressHandler:^(__kindof SDLRPCRequest * _Nonnull request, __kindof SDLRPCResponse * _Nullable response, NSError * _Nullable error, float percentComplete) { - TestRequestProgressResponse *progressResponse = testProgressResponses[request.correlationID]; - - expect(progressResponse.percentComplete).to(beCloseTo(percentComplete)); - expect(response).toNot(beNil()); - expect(error).to(beNil()); + __block NSError *testError = nil; + __block BOOL testSuccess = NO; - [resultResponses addObject:response]; + testOperation = [[SDLAsynchronousRPCRequestOperation alloc] initWithConnectionManager:testConnectionManager requests:sendRequests.copy progressHandler:^(__kindof SDLRPCRequest * _Nonnull request, __kindof SDLRPCResponse * _Nullable response, NSError * _Nullable error, float percentComplete) { + if (testError == nil) { testError = error; } + if (response != nil) { [resultResponses addObject:response]; } } completionHandler:^(BOOL success) { - expect(resultResponses).to(haveCount(3)); - expect(success).to(beTruthy()); + testSuccess = success; }]; [testOperationQueue addOperation:testOperation]; [NSThread sleepForTimeInterval:0.5]; + + expect(testSuccess).toEventually(beTruthy()); + expect(testError).toEventually(beNil()); }); }); |