Allow createSpyObj to be called with just an array of method names

[Finish #50757607] #321
This commit is contained in:
Gregg Van Hove
2015-01-12 15:16:50 -08:00
parent 69a61547e7
commit 3140d5fb95
3 changed files with 19 additions and 1 deletions

View File

@@ -105,6 +105,11 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
};
j$.createSpyObj = function(baseName, methodNames) {
if (j$.isArray_(baseName) && j$.util.isUndefined(methodNames)) {
methodNames = baseName;
baseName = 'unknown';
}
if (!j$.isArray_(methodNames) || methodNames.length === 0) {
throw 'createSpyObj requires a non-empty array of method names to create spies for';
}