MyMocker contains a koan built with Cucumber and some customised formatting that goes about stepping you through the process of creating a mocking class.
Start by running rake or cucumber from the project root and see how you go!
At the moment, the class can only mock or stub no-argument methods or methods with only one argument.
At certain stages through the koan, you get prompted to run the example features, which actually use the class that you have built in “real world” (contrived..?) situations. The command is:
rake cukoan:examples
The goal is to show a simple but powerful use of the method_missing paradigm in Ruby, and demonstrate the difference between mocks and stubs.
A bonus goal is to do it in the smallest amount of code possible. I’ve done it in twenty eight lines with sensible whitespace and logic per line, so that is the bar.