Created
October 14, 2010 14:34
-
-
Save camelpunch/626257 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| var stubChainedMethods = function (obj, methods) { | |
| if (methods.length === 0) { | |
| return null; | |
| } else { | |
| obj[methods[0]] = function () { | |
| return obj; | |
| }; | |
| return stubChainedMethods(obj, methods.slice(1, methods.length)); | |
| } | |
| }; |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Used for stubbing methods on objects whereby you don't want to set an expectation, but do want them not to raise. e.g. node.get(query).addClass('something')