diff --git a/Source/OCMockito/NSInvocation+TKAdditions.m b/Source/OCMockito/NSInvocation+TKAdditions.m index ffba153c..c2c52ffc 100755 --- a/Source/OCMockito/NSInvocation+TKAdditions.m +++ b/Source/OCMockito/NSInvocation+TKAdditions.m @@ -185,6 +185,11 @@ void MKTSetReturnValueForInvocation(NSInvocation *invocation, id returnValue) long long value = [returnValue longLongValue]; [invocation setReturnValue:&value]; } + else if(strcmp(returnType, @encode(BOOL)) == 0) + { + BOOL value = [returnValue boolValue]; + [invocation setReturnValue:&value]; + } else if (strcmp(returnType, @encode(unsigned char)) == 0) { unsigned char value = [returnValue unsignedCharValue]; diff --git a/Source/Tests/StubProtocolTest.m b/Source/Tests/StubProtocolTest.m index 68329441..eecf4d07 100644 --- a/Source/Tests/StubProtocolTest.m +++ b/Source/Tests/StubProtocolTest.m @@ -25,6 +25,7 @@ @protocol ReturningProtocol - (id)methodReturningObject; - (id)methodReturningObjectWithArg:(id)arg; - (id)methodReturningObjectWithIntArg:(int)arg; +- (BOOL)methodReturningBOOL; - (short)methodReturningShort; @end @@ -89,6 +90,12 @@ - (void)testShouldSupportShortcutForSpecifyingMatcherForFirstArgument assertThat([mockProtocol methodReturningObjectWithIntArg:2], is(@"FOO")); } +- (void)testStubbedMethod_ShouldReturnGivenBool +{ + [given([mockProtocol methodReturningBOOL]) willReturnBool:YES]; + assertThatBool([mockProtocol methodReturningBOOL], equalToBool(YES)); +} + - (void)testStubbedMethod_ShouldReturnGivenShort { [given([mockProtocol methodReturningShort]) willReturnShort:42];