export function stub(obj, method, callback=_.noop, { as:name, returns }) { beforeEach(function() { const stub = this.sinon.stub(obj, 'method', (...args) => { callback.call(this, ...args); }); if (returns) stub.returns(returns); if (name) _.set(this, name, stub); }); } export function spy(name) { beforeEach(function() { _.set(this, name, this.sinon.spy()); }) }