MichaelHackett / Kiwi

BDD for iOS
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Add HOM-style message matchers for test spies #3

Open MichaelHackett opened 11 years ago

MichaelHackett commented 11 years ago

The message matchers for mocks support higher-order-messaging (HOM) for defining expectations, where the matcher method returns an invocation capturer that receives the next message in the chain and turns it into a KWMessagePattern internally.

At first, I found this style less clear, but I've since seen that it's a fairly widely documented and accepted idiom, and I've been experimenting with both styles and can see some cases where the HOM version is more concise and easier to read (provided you understand what it is doing, which isn't obvious if you aren't familiar with the idiom).

At the moment, I have left the code for the HOM versions of the matchers from KWReceiveMatcher commented out in the new spy matcher class, KWHaveReceivedMatcher, as they may be useful as an outline for the new code. As they are just an alternative way to express functionality that is already present in the matcher, I don't think this is a high enough priority for me to work on right at the moment, but it should be done before submitting the test spy package for review.