From bbf3f6825cc5671020a03b2f5f5b20627c4feaed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20Kope=C4=87?= Date: Sun, 28 Feb 2016 21:36:09 +0100 Subject: [PATCH] Improve error message when passing a non-function to callFake --- spec/core/SpyStrategySpec.js | 16 ++++++++++++++-- src/core/SpyStrategy.js | 3 +++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/spec/core/SpyStrategySpec.js b/spec/core/SpyStrategySpec.js index d613188d..860811b8 100644 --- a/spec/core/SpyStrategySpec.js +++ b/spec/core/SpyStrategySpec.js @@ -92,6 +92,18 @@ describe("SpyStrategy", function() { expect(returnValue).toEqual(67); }); + it('throws an error when a non-function is passed to callFake strategy', function() { + var originalFn = jasmine.createSpy('original'), + invalidFakes = [5, 'foo', {}, true, false, null, void 0, new Date(), /.*/]; + + for (var i=0; i