正しく実行しているかどうかはわかりませんが、コアデータオブジェクトでNSNumberプロパティをスタブ化しようとしています。
これが私のテスト例です:
it(@"should say 1 / ? with 1 point", ^{
mockCard = [KWMock nullMockForClass:[Card class]];
[mockCard stub:@selector(points) andReturn:[NSNumber numberWithInt:1]];
controller.card = mockCard;
[[controller.lblCount.text should] equal:@"1 / ?"];
});
そして私のソースコード:
-(void)setCard:(Card *)aCard{
if ([card.points intValue] == 1) {
lblCount.text = @"1 / ?";
}
}
これを実行すると、メソッドでSIGKIL
エラーが発生します。writeObjectValueToInvocationReturnValue
私は何かが足りないのですか?
アップデート
スタブを次のように変更しようとしました:
[mockCard stub:@selector(points) andReturn:theValue(1)]
...
[FAILED], wrapped stub value type (i) could not be converted to the target type (v)