code: function beforeFirstCall(instance, method, callback) {
    instance[method] = function() {
      delete instance[method];
      callback.apply(this, arguments);
      return this[method].apply(this, arguments);
    };
  }
docs: Patch the given method of instance so that the callback is executed once, before the actual method is called the first time.