Merge branch 'StephanBijzitter-throw-for-constants'

Fixes #948
This commit is contained in:
Gregg Van Hove
2015-10-26 16:29:29 -07:00
3 changed files with 36 additions and 0 deletions

View File

@@ -1992,6 +1992,11 @@ getJasmineRequireObj().SpyRegistry = function(j$) {
throw new Error(methodName + ' has already been spied upon');
}
var descriptor = Object.getOwnPropertyDescriptor(obj, methodName);
if (!(descriptor.writable || descriptor.set)) {
throw new Error(methodName + ' is not declared writable or has no setter');
}
var spy = j$.createSpy(methodName, obj[methodName]);
currentSpies().push({