Open notmessenger opened 7 years ago
I don't think those sinon
methods let you control when the promise resolves/rejects, do they?
Not sure about anyone else, but I always explicitly trigger the resolve/reject in a separate beforeEach
from where the promise was returned, so I can check for things that should be happening between when the promise is returned and when it resolves/rejects.
That being said, I can create a helper somewhere else, as it's got nothing to do with ember, that creates the resolver
that returnPromiseFromStub()
creates, and we can use sinon's .returns()
to return the resolver.promise
and still achieve the same thing, so I don't mind getting rid of returnsPromiseFromStub()
in the next major release.
returnPromiseFromStub
in addon-test-support/stub.jshttp://sinonjs.org/releases/v2.2.0/stubs/
stub.resolves(value)
stub.rejects()
stub.rejects("TypeError")
stub.rejects(value)
stub.usingPromise(promiseLibrary)