I am using GHUnit & OCMock to do some testing work in my iOS app.
So I have some trouble integrating them.
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]; into
[[[mock stub] andDo:^(NSInvocation *invocation) {
[invocation setReturnValue:@"255"];
}] capitalizedString];
I got an error which says "Reason: 'NSCFString' should be equal to '255'. Should be equal"
I think the two statements should do exactly the same thing. Am I wrong?