Skip to content

Commit

Permalink
Make calledAfter symetric with calledBefore
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasfcosta committed May 17, 2017
1 parent ad78132 commit c94d00a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/sinon/spy.js
Expand Up @@ -264,7 +264,7 @@ var spyApi = {
return false;
}

return this.callIds[this.callCount - 1] > spyFn.callIds[spyFn.callCount - 1];
return this.callIds[this.callCount - 1] > spyFn.callIds[0];
},

calledImmediatelyBefore: function calledImmediatelyBefore(spyFn) {
Expand Down
4 changes: 2 additions & 2 deletions test/spy-test.js
Expand Up @@ -1641,12 +1641,12 @@ describe("spy", function () {
assert.isFalse(this.spyA.calledAfter(this.spyB));
});

it("returns false if other called last", function () {
it("returns true if called anytime after other", function () {
this.spyB();
this.spyA();
this.spyB();

assert.isFalse(this.spyA.calledAfter(this.spyB));
assert.isTrue(this.spyA.calledAfter(this.spyB));
});
});

Expand Down

0 comments on commit c94d00a

Please sign in to comment.