handle async code of controller

The previous commit cannot handle asynchronous controller.
use sinon.stub to handle this.