Skip to content

Commit

Permalink
Fix regression for issue sinonjs#1526 regarding onFirstCall().throws()
Browse files Browse the repository at this point in the history
  • Loading branch information
George Schneeloch committed Aug 14, 2017
1 parent 350717d commit 7b53434
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/sinon/behavior.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ var proto = {
isPresent: function isPresent() {
return (typeof this.callArgAt === "number" ||
this.exception ||
this.exceptionCreator ||
typeof this.returnArgAt === "number" ||
this.returnThis ||
this.resolveThis ||
Expand Down
13 changes: 13 additions & 0 deletions test/stub-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,19 @@ describe("stub", function () {
stub();
});
});

it("throws only on the first call", function () {
var stub = createStub.create();
stub.returns("no exception");
stub.onFirstCall().throws();

assert.exception(function () {
stub();
});

// on the second call there is no exception
assert.same(stub(), "no exception");
});
});

describe(".resolves", function () {
Expand Down

0 comments on commit 7b53434

Please sign in to comment.