Cleanup spy promise strategies to be more consistent with Jasmine at large

- Rename `resolveWith` to `resolveTo` to match `toBeResolvedTo`
- No longer wrap non-Errors in `rejectWith`

- Fixes #1715
This commit is contained in:
Gregg Van Hove
2019-05-23 17:29:12 -07:00
parent b4cbe9850f
commit 8af669677a
4 changed files with 16 additions and 18 deletions

View File

@@ -208,7 +208,7 @@ describe('Spies', function() {
it('works with global Promise library when available', function(done) {
jasmine.getEnv().requirePromises();
var spy = env.createSpy('foo').and.resolveWith(42);
var spy = env.createSpy('foo').and.resolveTo(42);
spy()
.then(function(result) {
expect(result).toEqual(42);
@@ -225,7 +225,7 @@ describe('Spies', function() {
customPromise.resolve.and.returnValue('resolved');
env.configure({ Promise: customPromise });
var spy = env.createSpy('foo').and.resolveWith(42);
var spy = env.createSpy('foo').and.resolveTo(42);
expect(spy()).toEqual('resolved');
expect(customPromise.resolve).toHaveBeenCalledWith(42);
});