I'm using the MVVM paradigm in my current iOS app. Recently, I have also started using ReactiveCocoa
with the project. I've now moved onto experimenting with Unit testing
as well.
The problem I am facing is how to correctly test the custom RACSignal
s I have created. Here is an example of a test signal I am testing. This signal is used with a UItextField
and will stop unwanted characters being entered into the textField. In this case, I am only allowing numbers:
//Declared like so:
-(RACSignal *)onlyAllowNumbersforTextFieldSignal:(RACSignal *)signal
//used like this:
RAC(testTextField, text) = [self.viewModel onlyAllowNumbersforTextFieldSignal:testTextField.rac_textSignal];
Now the signal works perfectly in the viewModel
and in the viewController
- I now just want to create a test case
for these sorts of signals.