Skip to content

Commit

Permalink
Fix stub id prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
mantoni authored and mroderick committed May 7, 2018
1 parent c0eb019 commit c13bea3
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/sinon/stub.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ var proto = {
};

var orig = functionStub;
functionStub.id = "stub#" + uuid++;
functionStub = spy.create(functionStub, stubLength);
functionStub.id = "stub#" + uuid++;
functionStub.func = orig;

extend(functionStub, stub);
Expand Down
8 changes: 8 additions & 0 deletions test/spy-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2783,5 +2783,13 @@ describe("spy", function () {
]);
});
});

describe(".id", function () {
it("should start with 'spy#'", function () {
for (var i = 0; i < 10; i++) {
assert.isTrue(createSpy().id.indexOf("spy#") === 0);
}
});
});
});

8 changes: 8 additions & 0 deletions test/stub-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2961,4 +2961,12 @@ describe("stub", function () {
assert.equals(myObj.prop, "newString");
});
});

describe(".id", function () {
it("should start with 'stub#'", function () {
for (var i = 0; i < 10; i++) {
assert.isTrue(createStub().id.indexOf("stub#") === 0);
}
});
});
});

0 comments on commit c13bea3

Please sign in to comment.