Cuckoo icon indicating copy to clipboard operation
Cuckoo copied to clipboard

OCMock - How to verify that a method has been called a certain number of times

Open levantAJ opened this issue 5 years ago • 1 comments

Currently I wanna make sure that the method numberOfSections(in:) just called only once time, any posibilty to make it as objcVerify(mock, times(1)).numberOfSections(in: tableView))? thanks 🙏

// stubbing the class is very similar to stubbing with Cuckoo
let mock = objcStub(for: UITableViewController.self) { stubber, mock in
  stubber.when(mock.numberOfSections(in: tableView)).thenReturn(1)
}

objcVerify(mock.numberOfSections(in: tableView))

levantAJ avatar Aug 17 '20 07:08 levantAJ

We may not have support for this at the moment. If you're feeling adventurous, feel free to add the feature yourself. I feel like this should not be too difficult to add. If you do file a PR along with some tests, I'm sure we can get this added in no time.

MatyasKriz avatar Aug 20 '20 20:08 MatyasKriz