How to test if a method of an object is called inside completion handler block using OCMock?
- 阅读更多 关于 How to test if a method of an object is called inside completion handler block using OCMock?
问题 I have a method: @implementation SomeClass - (void)thisMethod:(ObjectA *)objA { [APIClient connectToAPIWithCompletionHandler:^(id result){ if (result) [objA methodOne]; else [objA methodTwo]; }]; } Is there a way to verify methodOne or methodTwo will be called when thisMethod: is called? Basically I just want to stub that connectToAPIWithCompletionHandler: method. Right now I can do this by swizzling connectToAPIWithCompletionHandler: method. But I want to know if there's better way. I found