Permalink
Browse files

Merge pull request #12 from andreyvit/master

A couple of bug fixes
  • Loading branch information...
2 parents 85cb0ba + 48a2cc7 commit 766c4ec64517f2bde5deb981d482eee5ada6493c @felixge committed Jun 3, 2012
Showing with 3 additions and 1 deletion.
  1. +3 −1 lib/gently/gently.js
View
@@ -115,6 +115,8 @@ Gently.prototype.verify = function(msg) {
}
}
+ this.expectations = []; // reset so that no duplicate verification attempts are made
+
if (!validExpectations.length) {
return;
}
@@ -147,7 +149,7 @@ Gently.prototype._stubFn = function(self, obj, method, name, args) {
// autorestore original if its not a closure
// and no more expectations on that object
- has_more_expectations = this.expectations.reduce(function (memo, expectation) {
+ var has_more_expectations = this.expectations.reduce(function (memo, expectation) {
return memo || (expectation.obj === obj && expectation.method === method);
}, false);
if (obj !== null && method !== null && !has_more_expectations) {

0 comments on commit 766c4ec

Please sign in to comment.