Created
April 25, 2011 11:37
-
-
Save gotascii/940398 to your computer and use it in GitHub Desktop.
simple node stubs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
stubs = [] | |
module.exports = | |
stub: (obj, name, fun) -> | |
stubs.push({'obj':obj, 'name':name, 'fun':obj[name]}) | |
obj[name] = if fun? then fun else -> | |
unstub: -> | |
for stubbed in stubs | |
stubbed.obj[stubbed.name] = stubbed.fun | |
stubs.length = 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment