pivotal/cedar — pull request #209 by pivotal-brian-croom (2014-04-07 17:37:15+00:00)
Title: Stub and_do_block with a block taking the same arguments as the method

This iteration on the feature forgoes using imp_implementationWithBlock altogether, and instead has NSInvocation call directly into the stub block's code. This is done after modifying the invocation to put the pointer to the block in arg 0, and remove the SEL _cmd argument altogether. This achieves the goal of not requiring the user of the API to include an initial 'id obj' parameter in the block, while simultaneously having no restrictions on the quantity or types of the arguments of the method being stubbed. Additionally, no third-party dependencies are required to make it happen.

This code includes full type checking on the return value and arguments of the provided block.