Nicer error messages for spyOn when null is provided

Fixes #1258
This commit is contained in:
Gregg Van Hove
2017-02-15 15:55:27 -08:00
parent 52876a7bf2
commit 9fbd0ba551
3 changed files with 20 additions and 4 deletions

View File

@@ -12,11 +12,11 @@ getJasmineRequireObj().SpyRegistry = function(j$) {
this.spyOn = function(obj, methodName) {
if (j$.util.isUndefined(obj)) {
if (j$.util.isUndefined(obj) || obj === null) {
throw new Error(getErrorMsg('could not find an object to spy upon for ' + methodName + '()'));
}
if (j$.util.isUndefined(methodName)) {
if (j$.util.isUndefined(methodName) || methodName === null) {
throw new Error(getErrorMsg('No method name supplied'));
}