Add calls accessor to spies

This commit is contained in:
Rajan Agaskar & Ryan Dy 2009-10-13 14:28:46 -07:00
parent 3459697cb4
commit c164d58a1a

View File

@ -189,6 +189,7 @@ jasmine.Spy = function(name) {
* mySpy.argsForCall[1] = [7, 8];
*/
this.argsForCall = [];
this.calls = [];
};
/**
@ -283,6 +284,7 @@ jasmine.Spy.prototype.reset = function() {
this.wasCalled = false;
this.callCount = 0;
this.argsForCall = [];
this.calls = [];
this.mostRecentCall = {};
};
@ -292,13 +294,10 @@ jasmine.createSpy = function(name) {
spyObj.wasCalled = true;
spyObj.callCount++;
var args = jasmine.util.argsToArray(arguments);
//spyObj.mostRecentCall = {
// object: this,
// args: args
//};
spyObj.mostRecentCall.object = this;
spyObj.mostRecentCall.args = args;
spyObj.argsForCall.push(args);
spyObj.calls.push({object: this, args: args});
return spyObj.plan.apply(this, arguments);
};