-
Notifications
You must be signed in to change notification settings - Fork 118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Capturing arguments? #15
Comments
Argument capturing isn't present today, but has been on my wish list. |
@jonreid - are we any closer to this elusive dream? :) |
Another reason for wanting argument capture is that it makes it possible to then use asserts on the captured arguments. These are more informative on failure than the messages emitted when using hamcrest matchers directly in a verify(). |
I've started on this |
Give it a try! See ArgumentCaptorTest.m for examples. |
Is there a mechanism to capture arguments?
Most asynchronous APIs (especially for networking libraries) accept completion blocks. It'd be awesome to be able to capture the completion block and test against it.
For example, suppose I mock a NSURLConnector. (Thanks for showing me we can mock class methods earlier today on StackOverflow!) Then I want to verify that my code calls sendAsynchronousRequest:queue:completionHandler. I'd love to capture the completionBlock and verify the operations in the completion handler.
This request is similar to this request for Kiwi.
The text was updated successfully, but these errors were encountered: