Created
October 30, 2013 22:56
-
-
Save asmallteapot/7241750 to your computer and use it in GitHub Desktop.
Returning BOOL values from mocked & stubbed methods using OCMock.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @property (nonatomic) BOOL enabled; | |
// someObject = [OCMock partialMockForObject:[[SomeObject alloc] init]]; | |
[[[mock stub] andDo:^(NSInvocation *invocation) { | |
BOOL enabled = someObject.enabled; | |
NSValue *returnValue = [NSValue valueWithBytes:&enabled objCType:@encode(BOOL)]; | |
[invocation setReturnValue:&returnValue]; | |
}] enabled]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment