开发者

Kiwi stub isn't working with NSNumber, ends in SIGKILL

开发者 https://www.devze.com 2023-04-11 05:21 出处:网络
I\'m not sure if I\'m doing it right but I\'m trying to stub an NSNumber property on a core data object.

I'm not sure if I'm doing it right but I'm trying to stub an NSNumber property on a core data object.

Here's my test example:

   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 / ?"];     
   });

And my source code:

 -(void)setCard:(Card *)aCard{
     if ([card.points intValue] == 1) {
          lblCount.text = @"1 / ?";
     }
 }

Running this causes a SIGKIL err开发者_如何学编程or in the writeObjectValueToInvocationReturnValue method.

Am I missing something?

Update

attempted to change the stub to:

[mockCard stub:@selector(points) andReturn:theValue(1)]
...

 [FAILED], wrapped stub value type (i) could not be converted to the target type (v)


This is bug in Kiwi and is described here: https://github.com/allending/Kiwi/issues/63

0

精彩评论

暂无评论...
验证码 换一张
取 消