Skip to content

Instantly share code, notes, and snippets.

@camelpunch
Created October 14, 2010 14:34
Show Gist options
  • Select an option

  • Save camelpunch/626257 to your computer and use it in GitHub Desktop.

Select an option

Save camelpunch/626257 to your computer and use it in GitHub Desktop.
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));
}
};
@camelpunch
Copy link
Author

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')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment