Add calls accessor to spies
This commit is contained in:
parent
3459697cb4
commit
c164d58a1a
@ -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);
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user