Uses jasmine spy to mock asynchronous functions. Put this in your jasmine helpers.