Improve error message when passing a non-function to callFake

This commit is contained in:
Andrzej Kopeć
2016-02-28 21:36:09 +01:00
parent b6798cdb06
commit bbf3f6825c
2 changed files with 17 additions and 2 deletions

View File

@@ -45,6 +45,9 @@ getJasmineRequireObj().SpyStrategy = function() {
};
this.callFake = function(fn) {
if(!(fn instanceof Function)) {
throw new Error('Argument passed to callFake should be a function, got ' + fn);
}
plan = fn;
return getSpy();
};