I'm using MVVM with ReactiveCocoa, and OCMockito for testing. Suppose I have a ViewController A and ViewController B. A needs to perform a segue to B. I want to verify that when this happens, A passes the necessary data (the 'model') along to B via assignment first.
B
looks like this:
@interface ViewControllerB : UITableViewController
@property(nonatomic, readonly) ViewModel *viewModel;
@end
Somewhere in view controller A
, there is a statement:
viewControllerB.viewModel.model = newModel; // passes new data along for B to display
I want to verify that this assignment is happening, but viewModel
property is readonly. The viewModel is initialised by the viewController's init method.
How could I mock out the viewModel here?
I could partial mock viewControllerB to return a mock viewModel
, which then I verify on but https://github.com/jonreid/OCMockito/issues/38 says that partial mocks have since been removed. Why?!