I use GHUnit and OCMock to run some tests in my iOS application.
I have some problems with their integration.
The following code works well.
NSString *s = [NSString stringWithString:@"122"]; id mock = [OCMockObject partialMockForObject:s]; [[[mock stub] andReturn:@"255"] capitalizedString]; NSString *returnValue = [mock capitalizedString]; GHAssertEqualObjects(returnValue, @"255", @"Should be equal"); [mock verify];
But when I change [[[mock stub] andReturn: @ "255"] capitalizedString]; in
[[[mock stub] andDo:^(NSInvocation *invocation) { [invocation setReturnValue:@"255"]; }] capitalizedString];
I got the error "Reason:" NSCFString "must be equal to" 255 ". Must be equal to"
I think the two statements should do the same. I'm wrong?
source share