This is reimplementing test/utils.js makeStubMethod with less power and less flexibility, AFAICT.  Consider switching to it?