Jasmine - Two Spies For The Same Method
I'm new to Jasmine and I wanted to know if we can create 2 spies for the same method. Here is what I'm trying. describe('something', function () { beforeEach(function () {
Solution 1:
instead of
describe('Here is the action!', function () {
mySpy = jasmine.createSpyObj('mySpy', 'functionInInterest');
mySpy.functionInInterest.andCallFake(function (cb) {cb(somethingElse);});
//Some test cases that depends on somethingElse
});
do this
describe('Here is the action!', function () {
mySpy_2 = jasmine.createSpyObj('mySpy', 'functionInInterest');
mySpy_2.functionInInterest.andCallFake(function (cb) {cb(somethingElse);});
//Some test cases that depends on somethingElse
});
Post a Comment for "Jasmine - Two Spies For The Same Method"