I am currently studying how to effectively add some unit tests to my ViewControllers application. So far, this has worked very well, until I tried to make it that a particular view controller represents another.
I use OCMock and XCTest. The test is as follows
id partialMock = OCMPartialMock([TestViewController class]); [partialMock doSomeStuff]; OCMVerify([partialMock presentViewController:[OCMArg any] animated:[OCMArg any] completion:[OCMArg any]]);
As you can see, I only want to check that presentViewController was called in the view controller under test inside doSomeStuff . Please note that this example is a simplified version of what I have. The main difference is that I verify that the viewController argument is another mocked object.
The problem is that the doSomeStuff method doSomeStuff not muted, the call is then redirected to the real instance of TestViewController , which then calls presentViewController itself, and then does not start the partialMock check.
Is there something I am missing? Or is it really being canceled, what am I trying to achieve?
source share