Skip to content

Commit

Permalink
Merge pull request #1500 from cypress-io/issues/#1487
Browse files Browse the repository at this point in the history
Fix #1487: Reduced test case
  • Loading branch information
fatso83 authored Jul 28, 2017
2 parents cbf1128 + b7ce6dd commit 0d099aa
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/sinon/spy.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,9 @@ var spyApi = {

// Make return value and exception available in the calls:
createCallProperties.call(this);
matchings.forEach(function (matching) {
createCallProperties.call(matching);
});

if (exception !== undefined) {
throw exception;
Expand Down
17 changes: 17 additions & 0 deletions test/issues/issues-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

var referee = require("referee");
var sinon = require("../../lib/sinon");
var createStub = require("../../lib/sinon/stub");
var assert = referee.assert;
var refute = referee.refute;

Expand Down Expand Up @@ -298,4 +299,20 @@ describe("issues", function () {
assert.equals(window.innerHeight, 111);
});
});

describe("#1487 - withArgs() returnValue", function () {
beforeEach(function () {
this.stub = createStub().throws("Nothing set");
this.stub.withArgs("arg").returns("return value");
this.stub("arg");
});

it("sets correct firstCall.returnValue", function () {
assert.equals(this.stub.withArgs("arg").firstCall.returnValue, "return value");
});

it("sets correct lastCall.returnValue", function () {
assert.equals(this.stub.withArgs("arg").lastCall.returnValue, "return value");
});
});
});

0 comments on commit 0d099aa

Please sign in to comment.