Skip to content

Instantly share code, notes, and snippets.

@jorgemanrubia
Created November 22, 2010 19:16
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jorgemanrubia/710465 to your computer and use it in GitHub Desktop.
Save jorgemanrubia/710465 to your computer and use it in GitHub Desktop.
Jasmine factory for creating spy objects with common JQuery methods. For the common need of a mock object that need to act as a JQuery object ($() requires a method `remove` and `unbind` to exist)
jasmine.create$SpyObj = function(name, listOfSpyMethods) {
listOfSpyMethods = listOfSpyMethods || ['unbind', 'remove'];
return jQuery.extend($('<div/>'), jasmine.createSpyObj(name, listOfSpyMethods));
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment