Reputation: 2073
To stub a the following method of the class Network
- (void)userLogin:(NSDictionary *)credentials
completionHandler:(void (^)(BOOL, id, NSError *))handler;
I create a mock like this:
id mock = OCMClassMock([Network class]);
I want to stub this method so the block gets called with arguments YES,nil,nil. How to stub the values for objects like NSError and id with nil?
Upvotes: 0
Views: 372
Reputation: 2073
You have to do this:
id mock = OCMClassMock([Network class]);
OCMStub([mock userLogin:[OCMArg any]
completionErrorHandler:([OCMArg invokeBlockWithArgs:OCMOCK_VALUE(YES), [NSNull null],
[NSNull null], nil])]);
Upvotes: 1