Skip to content

Commit

Permalink
Explicitly set the expectation to nil to avoid calling fulfill twice
Browse files Browse the repository at this point in the history
  • Loading branch information
0xced committed Oct 12, 2016
1 parent 83c33fb commit 025c82f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Tests/Tests/AFNetworkReachabilityManagerTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ - (void)testDomainReachabilityNotification {

- (void)verifyReachabilityStatusBlockGetsCalledWithManager:(AFNetworkReachabilityManager *)manager
{
__weak XCTestExpectation *expectation = [self expectationWithDescription:@"reachability status change block gets called"];
__weak __block XCTestExpectation *expectation = [self expectationWithDescription:@"reachability status change block gets called"];

typeof(manager) __weak weakManager = manager;
[manager setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status) {
Expand All @@ -98,6 +98,7 @@ - (void)verifyReachabilityStatusBlockGetsCalledWithManager:(AFNetworkReachabilit

if (reachable) {
[expectation fulfill];
expectation = nil;
}
}];

Expand Down

0 comments on commit 025c82f

Please sign in to comment.