Simple stub utility translated from Ruby's MiniTest
$ component install ericgj/ministub
Stub the method name
of obj
with val_or_fn
for the duration of block fn
.
var stub = require('ministub');
var foo = { bar: 'bar' };
stub(foo, 'bar', 'baz', function(){
foo.bar // 'baz'
});
foo.bar // 'bar'
MIT