Enable OCMock's `OCMQuantifier` for `objcVerify` function
Added support for OCMQuantifier to objcVerify function.
This PR fixes #366
Even though OCMock verifies by default that the method has been called at least once (see Quantifiers in OCMock docs), I set the default OCMQuantifier to .exactly(1) in objcVerify in order for it to behave the same as Cuckoo's verify, which defaults to the times(1) CallMatcher.
Let me know if this needs to be changed.
This is a great addition! I can't believe we missed this during initial implementation. I agree with merging this, though I'd like to ask you to include some tests with various quantifiers as well, please. π
I'm not sure about the default OCMQuantifier being .exactly(1). There's no doubt it is consistent with Cuckoo's default CallMatcher also being times(1). However, prior to this PR, objcVerify was actually checking against .atLeast(1) quantifier.
Because of this, existing tests might need to change after this PR, which, indeed, was necessary for the tests in Cuckoo (see this commit). It can be annoying and confusing for Cuckoo users to realize tests are failing after updating Cuckoo's version.
WDYT @MatyasKriz?
Other than that, I've added the requested tests.
Hmm, I see. That's a very good point. Unfortunately I don't have the analytics to see how much of an impact that would make. But yeah, we shouldn't include this change in a minor version update. I'll merge this in just before the next major update drops, but thanks a lot for noticing and implementing this!
@MatyasKriz @ajpallares did you think about merging this PR in a minor version with the slight change of matching the current behavior?
Avoiding the behavior change could be done in 2 different ways in my opinion:
- A: setting the default value to
.atLeast(1) - B: define
objcVerifytwo times, once without aquantifierfor keeping the current behavior intact and once withquantifierwhere one can explicitly define it
The outcome of both would be the very same and would allow shipping it in a minor version update.
Another PR could be opened with the current implementation of the PR where the default value matches to CallMatcher and would be shipped in next major version update.
* A: setting the default value to `.atLeast(1)`
I suppose that this is a nice enough solution to deliver the core feature of this PR. I'd then immediately create another PR that would change this to .exactly(1) that we could then merge for the next major update. π
@ajpallares I've rebased the relevant changes according to @rolandkakonyi's suggestion while leaving the PR that makes the quantifier consistent with Cuckoo's verify for when the next major version is released. This PR is already merged, so it can be closed and I'll release a new version in a minute. π
Thatβs great! Thank you all ππΌ