Created
July 21, 2016 09:12
-
-
Save imbaker/15f68c4a5b7e8c3f77fc87ac7d8a685a 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
# 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