I'm trying to test ReactiveCocoa code with Kiwi framework.
Here is code :
-(void)bindParentModel:(FEPVehiclePropertyModel*)theParentModel{
self.parentModel = theParentModel;
[RACObserve(self, parentModel.currentName) subscribeNext:^(NSString* modelName) {
self.avaliableVales = [FEPVehiclePropertyValuesContainer possibleVlauesForKey:modelName];
if (![self.avaliableVales containsObject:self.currentName]){
self.currentName = [self.avaliableVales firstObject];
}
}];
}
Here is test case
it(@"check vehicle model binding", ^{
NSArray* carModel = [FEPVehiclePropertyValuesContainer possibleVlauesForKey:@"2013"];
FEPVehiclePropertyModel* model = [[FEPVehiclePropertyModel alloc] init];
FEPVehiclePropertyModel* parenModel = [[FEPVehiclePropertyModel alloc] init];
parenModel.parentModel = nil;
parenModel.avaliableVales = carModel;
parenModel.currentName = [carModel lastObject];
[model bindParentModel:parenModel];
parenModel.currentName = [parenModel.avaliableVales firstObject];
[[model.currentName should] equal:@"2.0L GTDI EcoBoost 6-speed manual"];
});
Every time i run test case i've got a EXC_BAD_ACCESS at RACKVOTrampoline class when it tries to add observer
[self.target addObserver:self forKeyPath:self.keyPath options:options context:&RACKVOWrapperContext];
Any suggestions?
Production code works with ReactiveCocoa just fine.