Recently I needed to ‘unstub’ a method in Mocha. Browsing Mocha documentation and googling yielded no results. Apparently, Mocha doesn’t support a concept of ‘unstubbing’, i.e. recovering original implementation of a method that has been stubbed. After a little hacking, I found out that it’s quite easy (though not necessarily elegant) to call original implementation.
Tag Archives: hack
Unstubbing methods in Mocha
By szeryf
4 Comments | tags: alias_method, cheeseburger, hack, lolcats, mocha, ruby, stub, unit testing, unstub | posted in alias_method, cheeseburger, hack, lolcats, mocha, ruby, stub, unit testing, unstub
require ‘brain’
Pages
Archives
Top Posts
Meta
Blog Stats
- 265,604 hits