Don't clobber previous custom plans with later plans

[finishes #37288941]
This commit is contained in:
Gregg Van Hove
2018-01-22 12:10:24 -08:00
parent 170a6dce76
commit f20f78f82b
8 changed files with 109 additions and 35 deletions

View File

@@ -6,18 +6,18 @@ getJasmineRequireObj().SpyFactory = function(j$) {
this.createSpy = function(name, originalFn) {
return j$.Spy(name, originalFn, getCustomStrategies());
};
this.createSpyObj = function(baseName, methodNames) {
var baseNameIsCollection = j$.isObject_(baseName) || j$.isArray_(baseName);
if (baseNameIsCollection && j$.util.isUndefined(methodNames)) {
methodNames = baseName;
baseName = 'unknown';
}
var obj = {};
var spiesWereSet = false;
if (j$.isArray_(methodNames)) {
for (var i = 0; i < methodNames.length; i++) {
obj[methodNames[i]] = self.createSpy(baseName + '.' + methodNames[i]);
@@ -32,11 +32,11 @@ getJasmineRequireObj().SpyFactory = function(j$) {
}
}
}
if (!spiesWereSet) {
throw 'createSpyObj requires a non-empty array or object of method names to create spies for';
}
return obj;
};
}