diff --git a/spec/core/SpyStrategySpec.js b/spec/core/SpyStrategySpec.js index 25078e4c..cedc5338 100644 --- a/spec/core/SpyStrategySpec.js +++ b/spec/core/SpyStrategySpec.js @@ -112,9 +112,7 @@ describe("SpyStrategy", function() { describe("#resolveValue", function() { it("allows a resolved promise to be returned", function(done) { - if (!jasmineUnderTest.getPromise()) { - pending('Environment does not support promises.'); - } + jasmine.getEnv().requirePromises(); var originalFn = jasmine.createSpy("original"), spyStrategy = new jasmineUnderTest.SpyStrategy({fn: originalFn}); @@ -134,15 +132,13 @@ describe("SpyStrategy", function() { expect(function() { spyStrategy.resolveValue(37); - }).toThrowError('resolveValue is unavailable because the environment does not support promises.'); + }).toThrowError('resolveValue requires global Promise, or a `promiseLibrary` configured with `jasmine.getEnv().configure()`'); }); }); describe("#rejectValue", function() { it("allows a rejected promise to be returned", function(done) { - if (!jasmineUnderTest.getPromise()) { - pending('Environment does not support promises.'); - } + jasmine.getEnv().requirePromises(); var originalFn = jasmine.createSpy("original"), spyStrategy = new jasmineUnderTest.SpyStrategy({fn: originalFn}); @@ -162,7 +158,7 @@ describe("SpyStrategy", function() { expect(function() { spyStrategy.rejectValue(new Error('oops')); - }).toThrowError('rejectValue is unavailable because the environment does not support promises.'); + }).toThrowError('rejectValue requires global Promise, or a `promiseLibrary` configured with `jasmine.getEnv().configure()`'); }); }); diff --git a/src/core/SpyStrategy.js b/src/core/SpyStrategy.js index 27a42f8e..3aada4b2 100644 --- a/src/core/SpyStrategy.js +++ b/src/core/SpyStrategy.js @@ -94,7 +94,7 @@ getJasmineRequireObj().SpyStrategy = function(j$) { var Promise = j$.getPromise(); if (!Promise) { - throw new Error('resolveValue is unavailable because the environment does not support promises.'); + throw new Error('resolveValue requires global Promise, or a `promiseLibrary` configured with `jasmine.getEnv().configure()`'); } this.plan = function() { @@ -113,7 +113,7 @@ getJasmineRequireObj().SpyStrategy = function(j$) { var Promise = j$.getPromise(); if (!Promise) { - throw new Error('rejectValue is unavailable because the environment does not support promises.'); + throw new Error('rejectValue requires global Promise, or a `promiseLibrary` configured with `jasmine.getEnv().configure()`'); } this.plan = function() {