Skip to content

Commit

Permalink
Add test for #950, show that it has been fixed (#1435)
Browse files Browse the repository at this point in the history
See #950
  • Loading branch information
mroderick authored and mantoni committed May 28, 2017
1 parent 1f64b7f commit e0c75bd
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions test/issues/issues-test.js
Expand Up @@ -122,6 +122,33 @@ describe("issues", function () {
});
});

describe("#950 - first execution of a spy as a method renames that spy", function () {
it("should not rename spies", function () {
var expectedName = "proxy";

function bob() {}
var spy = sinon.spy(bob);

assert.equals(spy.name, expectedName);

var obj = { methodName: spy };
assert.equals(spy.name, expectedName);

spy();
assert.equals(spy.name, expectedName);

obj.methodName.call(null);
assert.equals(spy.name, expectedName);

obj.methodName();
assert.equals(spy.name, expectedName);

obj.otherProp = spy;
obj.otherProp();
assert.equals(spy.name, expectedName);
});
});

describe("#1026", function () {
it("should stub `watch` method on any Object", function () {
// makes sure that Object.prototype.watch is set back to its old value
Expand Down

0 comments on commit e0c75bd

Please sign in to comment.