Reputation: 15702
I want to use OCMock such that whenever someMethod
is called with any argument, it calls callBackMethod:
with argument "dict", which is an NSDictionary
. I found andCall:onObject:
but that doesn't seem to let you pass an argument. Is there a way to get this desired behavior?
Upvotes: 1
Views: 468
Reputation: 6279
You can use andDo:
and execute whatever you want in the given block.
id yourMock;//...
NSDictionary *dictionary;//...
id anObject;//...
[[[yourMock stub] andDo:^(NSInvocation *invocation) {
[anObject callBackMethod:dictionary];
}] someMethod];
Upvotes: 1