Skip to content

Instantly share code, notes, and snippets.

@imbaker
Created July 21, 2016 09:12
Show Gist options
  • Save imbaker/15f68c4a5b7e8c3f77fc87ac7d8a685a to your computer and use it in GitHub Desktop.
Save imbaker/15f68c4a5b7e8c3f77fc87ac7d8a685a to your computer and use it in GitHub Desktop.
# http://eclipsesource.com/blogs/2014/03/27/mocks-in-jasmine-tests/
window.mock = (constr, name) ->
keys = []
console.log "!" + constr.prototype.length
for key in constr.prototype
keys.push key
if keys.length > 0
return jasmine.createSpyObj(name || "mock", keys)
else
return new Object()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment