MKTArgumentCaptor & OCHamcrest
paweldudek opened this issue ยท 7 comments
Short question before I start firing pull requests ;)
MKTCapturingMatcher
uses a
- (void)captureArgument:(id)arg
{
if (!arg)
arg = [NSNull null];
[self.arguments addObject:arg];
}
method to record passed arguments. This is method is then tied into OCMockito code itself, meaning that this matcher won't work outside OCMockito world.
Is there any reason why matches:
method from OCHamcrest matcher interface is not used? It would then look like this:
- (void)matches:(id)arg
{
if (!arg)
arg = [NSNull null];
[self.arguments addObject:arg];
return YES;
}
So you're interested in a matcher like this outside of OCMockito?
Whoops, sorry @jonreid, totally forgot about this one. ๐
So basically I've written a simple helper for asserting notification in specs. The problem is that, sometimes, I want to use argument capturing functionality provided by MKTCapturingMatcher
. The problem is that it doesn't behave like a OCHamcrest
matcher and this I had to add custom logic to support this.
Perhaps this is more of an issue for OCHamcrest to support such matcher - it's super useful and I use it a lot ๐ WDYT?
Wow. Moving the work into -matches:
simplified a lot of code! This is just the beginning.
HCArgumentCaptor is now in OCHamcrest. ๐ Next step: deprecate MKTArgumentCaptor and MKTCapturingMatcher
Woho ๐
Thanks Jon!
Now in OCHamcrest v4.3.0