Use isFunction to check for functionness in callFake

- Fixes #1191
This commit is contained in:
Gregg Van Hove
2016-09-14 16:06:44 -07:00
parent 8624a52ee0
commit 4e47b78f1f
5 changed files with 19 additions and 11 deletions

View File

@@ -94,14 +94,14 @@ describe("SpyStrategy", function() {
it('throws an error when a non-function is passed to callFake strategy', function() {
var originalFn = jasmine.createSpy('original'),
spyStrategy = new jasmineUnderTest.SpyStrategy({fn: originalFn}),
invalidFakes = [5, 'foo', {}, true, false, null, void 0, new Date(), /.*/];
for (var i=0; i<invalidFakes.length; i++) {
var invalidFake = invalidFakes[i],
spyStrategy = new jasmineUnderTest.SpyStrategy({fn: originalFn});
spyOn(jasmineUnderTest, 'isFunction_').and.returnValue(false);
expect(function() {spyStrategy.callFake(invalidFake);}).toThrowError('Argument passed to callFake should be a function, got ' + invalidFake);
}
expect(function () {
spyStrategy.callFake(function() {});
}).toThrowError(/^Argument passed to callFake should be a function, got/);
});
it("allows a return to plan stubbing after another strategy", function() {