diff --git a/lib/sinon/mock.js b/lib/sinon/mock.js index 54084d8d0..5c27d17a2 100644 --- a/lib/sinon/mock.js +++ b/lib/sinon/mock.js @@ -71,6 +71,7 @@ extend(mock, { } var expectation = mockExpectation.create(method); + extend(expectation, this.object[method]); push.call(this.expectations[method], expectation); return expectation; diff --git a/test/issues/issues-test.js b/test/issues/issues-test.js index d9fff69f2..79bfb8345 100644 --- a/test/issues/issues-test.js +++ b/test/issues/issues-test.js @@ -375,4 +375,19 @@ describe("issues", function () { }); }); }); + + describe("#1442 - callThrough with a mock expectation", function () { + it("should call original method", function () { + var foo = { + bar: function () { } + }; + + var mock = this.sandbox.mock(foo); + mock.expects("bar").callThrough(); + + foo.bar(); + + mock.verify(); + }); + }); });