Skip to content

Commit

Permalink
* Fixed bound param for spies and made both arguments optional.
Browse files Browse the repository at this point in the history
  • Loading branch information
keeto committed Feb 20, 2011
1 parent a9741a9 commit b2b8f4b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Source/lib/spy.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
var extend = require('./utils').extend;

var Spy = function(fn, bound){
fn = fn || function(){};
var spy = function(){
var results,
args = Array.prototype.slice.call(arguments);
spy.$invocations++;
spy.$argStack.push(args);
try {
results = fn.apply(args || this, args);
results = fn.apply(bound || this, args);
} catch (e){
spy.$errors++;
spy.$errorStack.push(e);
Expand Down

0 comments on commit b2b8f4b

Please sign in to comment.