iosstubbingkiwi

Kiwi stub and return issue


I want to test the creation of my object using Kiwi. Consider construction like this

id objectOne = [ObjectOne objectWithAnotherObject:objectTwo];

Inside of this static method I set up my objectOne from objectTwo, which has defined enum/type property.

my Kiwi test looks like this.

ObjectTwo *objectTwo = [ObjectTwo mock];

[objectTwo stub:@selector(type) andReturn:theValue(typeOne)];

id objectOne = [ObjectOne objectWithAnotherObject:objectTwo];

The problem i'm facing with this right now is the exception:

[NSException raise:@"KWStubException" format:@"wrapped stub value type (%s) could not be converted to the target type (%s)", [self.value objCType], objCType];

Does it mean, that Kiwi wasn't able to convert object theValue(typeOne) back to enum value?

Im using XCODE 6 and the latest Kiwi release


Solution

  • As a solution, type @(typeOne) instead of theValue(typeOne)