kriomant/mockers

Feature request: `times(ANY)`, `times(AT_LEAST_ONCE)`

Closed this issue · 2 comments

I may want to use all the lovely features of mockers, but I also want to allow my mock do its and_return_clone or and_call_clone expectation any number of times, without failing the test if I get the wrong number.

This comes up a lot when writing tests for function that calls into a dependency an arbitrary number of times, where that number is very delicate on minor/unrelated changes to the source code. I don't really care about testing that exact number (which means I have to keep updating the test to get the right number) - I just care that it occurs at least once.

Now you can use

.times(..)  // Any number of times
.times(1..)  // At least once

Awesome!