in my fixture setUp i have the following
-(void)setUp{
_vc = [OCMockObject partialMockForObject:[[InboxViewController alloc] init]];
//stub out the view stuff
[[_vc stub] removeTask:OCMOCK_ANY];
[[_vc stub] insertTask:OCMOCK_ANY];
}
There are 15 tests in the fixture, however, I need to actually test that those 2 methods are invoked, so I wrote 2 tests
-(void)someTest{
[[_vc expect] removeTask:OCMOCK_ANY];
[_vc removeAllTasksFromList:taskList notInList:newTaskList];
[_vc verify];
}
but that test fails
i also tried
-(void)someTest{
[[_vc stopMocking];
[[_vc expect] removeTask:OCMOCK_ANY];
[[_vc stub] removeTask:OCMOCK_ANY];
[_vc removeAllTasksFromList:taskList notInList:newTaskList];
[_vc verify];
}
But the test still fails. Am I missing something, or is this just how OCMock works?
The only way I can make it work is like this
-(void)someTest{
//re create and init the mock object
_vc = [OCMockObject partialMockForObject:[[InboxViewController alloc] init]];
[[_vc expect] removeTask:OCMOCK_ANY];
[[_vc stub] removeTask:OCMOCK_ANY];
[_vc removeAllTasksFromList:taskList notInList:newTaskList];
[_vc verify];
}