diff --git a/test/collection-test.js b/test/collection-test.js index bb834068b..71862d536 100644 --- a/test/collection-test.js +++ b/test/collection-test.js @@ -458,29 +458,40 @@ describe("collection", function () { describe(".resetHistory", function () { beforeEach(function () { this.collection = Object.create(sinonCollection); - this.collection.fakes = [{ - // this fake has a resetHistory method - resetHistory: sinonSpy() - }, { - // this fake has a resetHistory method - resetHistory: sinonSpy() - }, { - // this fake pretends to be a spy, which does not have resetHistory method - // but has a reset method - reset: sinonSpy() - }]; + var spy1 = sinonSpy(); + spy1(); + + var spy2 = sinonSpy(); + spy2(); + + this.collection.fakes = [ + spy1, + spy2 + ]; }); it("resets the history on all fakes", function () { var fake0 = this.collection.fakes[0]; var fake1 = this.collection.fakes[1]; - var fake2 = this.collection.fakes[2]; this.collection.resetHistory(); - assert(fake0.resetHistory.called); - assert(fake1.resetHistory.called); - assert(fake2.reset.called); + refute(fake0.called); + refute(fake1.called); + }); + + it("calls reset on fake that do not have a resetHistory", function () { + var noop = function noop() {}; + + noop.reset = function reset() { + noop.reset.called = true; + }; + + this.collection.fakes.push(noop); + + this.collection.resetHistory(); + + assert.isTrue(noop.reset.called); }); });