kiwi-bdd / Kiwi

Simple BDD for iOS
BSD 3-Clause "New" or "Revised" License
4.14k stars 512 forks source link

theValue(BOOL) not working with should receive #700

Open seboslaw opened 6 years ago

seboslaw commented 6 years ago

Hey guys,

I have the following issue.

code does:

@implementation SomeLocationManagerWrapperClass
-(void) someMethod; {
    [self.locationManager setAllowsBackgroundLocationUpdates:TRUE];
}
@end

test does:

SomeLocationManagerWrapperClass *lm = [SomeLocationManagerWrapperClass new];
lm.locationManager = [CLLocationManager nullMock];
[[lm.locationManager should] receive:@selector(setAllowsBackgroundLocationUpdates:) withArguments:theValue(TRUE)];
[lm someMethod];

The problem is that this should/receive validation fails with

expected subject to receive -setAllowsBackgroundLocationUpdates:1  exactly 1 time, but received it 0 times

Interestingly enough, if I replace the [CLLocationManager nullMock] with a regular mock [CLLocationManager mock] I get the following error:

KWMockException "mock received unexpected message -setAllowsBackgroundLocationUpdates:<01> " raised

So it seems to me like the mapping of theValue(TRUE) is not working correctly here?