Rename a spy's callReturn and callThrow
.and.callReturn is now .and.returnValue .and.callThrow is now .and.throwError [finishes #56281634]
This commit is contained in:
@@ -1557,14 +1557,14 @@ getJasmineRequireObj().SpyStrategy = function() {
|
|||||||
return getSpy();
|
return getSpy();
|
||||||
};
|
};
|
||||||
|
|
||||||
this.callReturn = function(value) {
|
this.returnValue = function(value) {
|
||||||
plan = function() {
|
plan = function() {
|
||||||
return value;
|
return value;
|
||||||
};
|
};
|
||||||
return getSpy();
|
return getSpy();
|
||||||
};
|
};
|
||||||
|
|
||||||
this.callThrow = function(something) {
|
this.throwError = function(something) {
|
||||||
var error = (something instanceof Error) ? something : new Error(something);
|
var error = (something instanceof Error) ? something : new Error(something);
|
||||||
plan = function() {
|
plan = function() {
|
||||||
throw error;
|
throw error;
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ describe("ConsoleReporter", function() {
|
|||||||
reporter.jasmineStarted();
|
reporter.jasmineStarted();
|
||||||
reporter.specDone({status: "passed"});
|
reporter.specDone({status: "passed"});
|
||||||
|
|
||||||
timerSpy.elapsed.and.callReturn(1000);
|
timerSpy.elapsed.and.returnValue(1000);
|
||||||
|
|
||||||
out.clear();
|
out.clear();
|
||||||
reporter.jasmineDone();
|
reporter.jasmineDone();
|
||||||
@@ -127,7 +127,7 @@ describe("ConsoleReporter", function() {
|
|||||||
|
|
||||||
out.clear();
|
out.clear();
|
||||||
|
|
||||||
timerSpy.elapsed.and.callReturn(100);
|
timerSpy.elapsed.and.returnValue(100);
|
||||||
|
|
||||||
reporter.jasmineDone();
|
reporter.jasmineDone();
|
||||||
|
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ describe("Clock", function() {
|
|||||||
it("returns an id for the delayed function", function() {
|
it("returns an id for the delayed function", function() {
|
||||||
var fakeSetTimeout = jasmine.createSpy('setTimeout'),
|
var fakeSetTimeout = jasmine.createSpy('setTimeout'),
|
||||||
scheduleId = 123,
|
scheduleId = 123,
|
||||||
scheduleFunction = jasmine.createSpy('scheduleFunction').and.callReturn(scheduleId),
|
scheduleFunction = jasmine.createSpy('scheduleFunction').and.returnValue(scheduleId),
|
||||||
delayedFunctionScheduler = {scheduleFunction: scheduleFunction},
|
delayedFunctionScheduler = {scheduleFunction: scheduleFunction},
|
||||||
fakeGlobal = { setTimeout: fakeSetTimeout },
|
fakeGlobal = { setTimeout: fakeSetTimeout },
|
||||||
delayedFn = jasmine.createSpy('delayedFn'),
|
delayedFn = jasmine.createSpy('delayedFn'),
|
||||||
@@ -176,7 +176,7 @@ describe("Clock", function() {
|
|||||||
it("returns an id for the delayed function", function() {
|
it("returns an id for the delayed function", function() {
|
||||||
var fakeSetInterval = jasmine.createSpy('setInterval'),
|
var fakeSetInterval = jasmine.createSpy('setInterval'),
|
||||||
scheduleId = 123,
|
scheduleId = 123,
|
||||||
scheduleFunction = jasmine.createSpy('scheduleFunction').and.callReturn(scheduleId),
|
scheduleFunction = jasmine.createSpy('scheduleFunction').and.returnValue(scheduleId),
|
||||||
delayedFunctionScheduler = {scheduleFunction: scheduleFunction},
|
delayedFunctionScheduler = {scheduleFunction: scheduleFunction},
|
||||||
fakeGlobal = { setInterval: fakeSetInterval },
|
fakeGlobal = { setInterval: fakeSetInterval },
|
||||||
delayedFn = jasmine.createSpy('delayedFn'),
|
delayedFn = jasmine.createSpy('delayedFn'),
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ describe("buildExpectationResult", function() {
|
|||||||
|
|
||||||
it("delegates message formatting to the provided formatter if there was an Error", function() {
|
it("delegates message formatting to the provided formatter if there was an Error", function() {
|
||||||
var fakeError = {message: 'foo'},
|
var fakeError = {message: 'foo'},
|
||||||
messageFormatter = jasmine.createSpy("exception message formatter").and.callReturn(fakeError.message);
|
messageFormatter = jasmine.createSpy("exception message formatter").and.returnValue(fakeError.message);
|
||||||
|
|
||||||
var result = j$.buildExpectationResult(
|
var result = j$.buildExpectationResult(
|
||||||
{
|
{
|
||||||
@@ -31,7 +31,7 @@ describe("buildExpectationResult", function() {
|
|||||||
|
|
||||||
it("delegates stack formatting to the provided formatter if there was an Error", function() {
|
it("delegates stack formatting to the provided formatter if there was an Error", function() {
|
||||||
var fakeError = {stack: 'foo'},
|
var fakeError = {stack: 'foo'},
|
||||||
stackFormatter = jasmine.createSpy("stack formatter").and.callReturn(fakeError.stack);
|
stackFormatter = jasmine.createSpy("stack formatter").and.returnValue(fakeError.stack);
|
||||||
|
|
||||||
var result = j$.buildExpectationResult(
|
var result = j$.buildExpectationResult(
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ describe("Expectation", function() {
|
|||||||
|
|
||||||
it("wraps matchers's compare functions, passing in matcher dependencies", function() {
|
it("wraps matchers's compare functions, passing in matcher dependencies", function() {
|
||||||
var fakeCompare = function() { return { pass: true }; },
|
var fakeCompare = function() { return { pass: true }; },
|
||||||
matcherFactory = jasmine.createSpy("matcher").and.callReturn({ compare: fakeCompare }),
|
matcherFactory = jasmine.createSpy("matcher").and.returnValue({ compare: fakeCompare }),
|
||||||
matchers = {
|
matchers = {
|
||||||
toFoo: matcherFactory
|
toFoo: matcherFactory
|
||||||
},
|
},
|
||||||
@@ -80,7 +80,7 @@ describe("Expectation", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("wraps matchers's compare functions, passing the actual and expected", function() {
|
it("wraps matchers's compare functions, passing the actual and expected", function() {
|
||||||
var fakeCompare = jasmine.createSpy('fake-compare').and.callReturn({pass: true}),
|
var fakeCompare = jasmine.createSpy('fake-compare').and.returnValue({pass: true}),
|
||||||
matchers = {
|
matchers = {
|
||||||
toFoo: function() {
|
toFoo: function() {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -196,7 +196,7 @@ describe("JsApiReporter", function() {
|
|||||||
timer: timerSpy
|
timer: timerSpy
|
||||||
});
|
});
|
||||||
|
|
||||||
timerSpy.elapsed.and.callReturn(1000);
|
timerSpy.elapsed.and.returnValue(1000);
|
||||||
reporter.jasmineDone();
|
reporter.jasmineDone();
|
||||||
expect(reporter.executionTime()).toEqual(1000);
|
expect(reporter.executionTime()).toEqual(1000);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ describe("SpyStrategy", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("allows an original function to be called, passed through the params and returns it's value", function() {
|
it("allows an original function to be called, passed through the params and returns it's value", function() {
|
||||||
var originalFn = jasmine.createSpy("original").and.callReturn(42),
|
var originalFn = jasmine.createSpy("original").and.returnValue(42),
|
||||||
spyStrategy = new j$.SpyStrategy({fn: originalFn}),
|
spyStrategy = new j$.SpyStrategy({fn: originalFn}),
|
||||||
returnValue;
|
returnValue;
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@ describe("SpyStrategy", function() {
|
|||||||
spyStrategy = new j$.SpyStrategy({fn: originalFn}),
|
spyStrategy = new j$.SpyStrategy({fn: originalFn}),
|
||||||
returnValue;
|
returnValue;
|
||||||
|
|
||||||
spyStrategy.callReturn(17);
|
spyStrategy.returnValue(17);
|
||||||
returnValue = spyStrategy.exec();
|
returnValue = spyStrategy.exec();
|
||||||
|
|
||||||
expect(originalFn).not.toHaveBeenCalled();
|
expect(originalFn).not.toHaveBeenCalled();
|
||||||
@@ -50,7 +50,7 @@ describe("SpyStrategy", function() {
|
|||||||
var originalFn = jasmine.createSpy("original"),
|
var originalFn = jasmine.createSpy("original"),
|
||||||
spyStrategy = new j$.SpyStrategy({fn: originalFn});
|
spyStrategy = new j$.SpyStrategy({fn: originalFn});
|
||||||
|
|
||||||
spyStrategy.callThrow(new TypeError("bar"));
|
spyStrategy.throwError(new TypeError("bar"));
|
||||||
|
|
||||||
expect(function() { spyStrategy.exec(); }).toThrowError(TypeError, "bar");
|
expect(function() { spyStrategy.exec(); }).toThrowError(TypeError, "bar");
|
||||||
expect(originalFn).not.toHaveBeenCalled();
|
expect(originalFn).not.toHaveBeenCalled();
|
||||||
@@ -60,7 +60,7 @@ describe("SpyStrategy", function() {
|
|||||||
var originalFn = jasmine.createSpy("original"),
|
var originalFn = jasmine.createSpy("original"),
|
||||||
spyStrategy = new j$.SpyStrategy({fn: originalFn});
|
spyStrategy = new j$.SpyStrategy({fn: originalFn});
|
||||||
|
|
||||||
spyStrategy.callThrow("bar");
|
spyStrategy.throwError("bar");
|
||||||
|
|
||||||
expect(function() { spyStrategy.exec(); }).toThrowError(Error, "bar");
|
expect(function() { spyStrategy.exec(); }).toThrowError(Error, "bar");
|
||||||
expect(originalFn).not.toHaveBeenCalled();
|
expect(originalFn).not.toHaveBeenCalled();
|
||||||
@@ -68,7 +68,7 @@ describe("SpyStrategy", function() {
|
|||||||
|
|
||||||
it("allows a fake function to be called instead", function() {
|
it("allows a fake function to be called instead", function() {
|
||||||
var originalFn = jasmine.createSpy("original"),
|
var originalFn = jasmine.createSpy("original"),
|
||||||
fakeFn = jasmine.createSpy("fake").and.callReturn(67),
|
fakeFn = jasmine.createSpy("fake").and.returnValue(67),
|
||||||
spyStrategy = new j$.SpyStrategy({fn: originalFn}),
|
spyStrategy = new j$.SpyStrategy({fn: originalFn}),
|
||||||
returnValue;
|
returnValue;
|
||||||
|
|
||||||
@@ -81,7 +81,7 @@ describe("SpyStrategy", function() {
|
|||||||
|
|
||||||
it("allows a return to plan stubbing after another strategy", function() {
|
it("allows a return to plan stubbing after another strategy", function() {
|
||||||
var originalFn = jasmine.createSpy("original"),
|
var originalFn = jasmine.createSpy("original"),
|
||||||
fakeFn = jasmine.createSpy("fake").and.callReturn(67),
|
fakeFn = jasmine.createSpy("fake").and.returnValue(67),
|
||||||
spyStrategy = new j$.SpyStrategy({fn: originalFn}),
|
spyStrategy = new j$.SpyStrategy({fn: originalFn}),
|
||||||
returnValue;
|
returnValue;
|
||||||
|
|
||||||
@@ -99,12 +99,12 @@ describe("SpyStrategy", function() {
|
|||||||
|
|
||||||
it("returns the spy after changing the strategy", function(){
|
it("returns the spy after changing the strategy", function(){
|
||||||
var spy = {},
|
var spy = {},
|
||||||
spyFn = jasmine.createSpy('spyFn').and.callReturn(spy),
|
spyFn = jasmine.createSpy('spyFn').and.returnValue(spy),
|
||||||
spyStrategy = new j$.SpyStrategy({getSpy: spyFn});
|
spyStrategy = new j$.SpyStrategy({getSpy: spyFn});
|
||||||
|
|
||||||
expect(spyStrategy.callThrough()).toBe(spy);
|
expect(spyStrategy.callThrough()).toBe(spy);
|
||||||
expect(spyStrategy.callReturn()).toBe(spy);
|
expect(spyStrategy.returnValue()).toBe(spy);
|
||||||
expect(spyStrategy.callThrow()).toBe(spy);
|
expect(spyStrategy.throwError()).toBe(spy);
|
||||||
expect(spyStrategy.callFake()).toBe(spy);
|
expect(spyStrategy.callFake()).toBe(spy);
|
||||||
expect(spyStrategy.stub()).toBe(spy);
|
expect(spyStrategy.stub()).toBe(spy);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -3,10 +3,10 @@ describe("Timer", function() {
|
|||||||
var fakeNow = jasmine.createSpy('fake Date.now'),
|
var fakeNow = jasmine.createSpy('fake Date.now'),
|
||||||
timer = new j$.Timer({now: fakeNow});
|
timer = new j$.Timer({now: fakeNow});
|
||||||
|
|
||||||
fakeNow.and.callReturn(100);
|
fakeNow.and.returnValue(100);
|
||||||
timer.start();
|
timer.start();
|
||||||
|
|
||||||
fakeNow.and.callReturn(200);
|
fakeNow.and.returnValue(200);
|
||||||
|
|
||||||
expect(timer.elapsed()).toEqual(100);
|
expect(timer.elapsed()).toEqual(100);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
describe("toContain", function() {
|
describe("toContain", function() {
|
||||||
it("delegates to j$.matchersUtil.contains", function() {
|
it("delegates to j$.matchersUtil.contains", function() {
|
||||||
var util = {
|
var util = {
|
||||||
contains: jasmine.createSpy('delegated-contains').and.callReturn(true)
|
contains: jasmine.createSpy('delegated-contains').and.returnValue(true)
|
||||||
},
|
},
|
||||||
matcher = j$.matchers.toContain(util);
|
matcher = j$.matchers.toContain(util);
|
||||||
|
|
||||||
@@ -12,7 +12,7 @@ describe("toContain", function() {
|
|||||||
|
|
||||||
it("delegates to j$.matchersUtil.contains, passing in equality testers if present", function() {
|
it("delegates to j$.matchersUtil.contains, passing in equality testers if present", function() {
|
||||||
var util = {
|
var util = {
|
||||||
contains: jasmine.createSpy('delegated-contains').and.callReturn(true)
|
contains: jasmine.createSpy('delegated-contains').and.returnValue(true)
|
||||||
},
|
},
|
||||||
customEqualityTesters = ['a', 'b'],
|
customEqualityTesters = ['a', 'b'],
|
||||||
matcher = j$.matchers.toContain(util, customEqualityTesters);
|
matcher = j$.matchers.toContain(util, customEqualityTesters);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
describe("toEqual", function() {
|
describe("toEqual", function() {
|
||||||
it("delegates to equals function", function() {
|
it("delegates to equals function", function() {
|
||||||
var util = {
|
var util = {
|
||||||
equals: jasmine.createSpy('delegated-equals').and.callReturn(true)
|
equals: jasmine.createSpy('delegated-equals').and.returnValue(true)
|
||||||
},
|
},
|
||||||
matcher = j$.matchers.toEqual(util),
|
matcher = j$.matchers.toEqual(util),
|
||||||
result;
|
result;
|
||||||
@@ -14,7 +14,7 @@ describe("toEqual", function() {
|
|||||||
|
|
||||||
it("delegates custom equality testers, if present", function() {
|
it("delegates custom equality testers, if present", function() {
|
||||||
var util = {
|
var util = {
|
||||||
equals: jasmine.createSpy('delegated-equals').and.callReturn(true)
|
equals: jasmine.createSpy('delegated-equals').and.returnValue(true)
|
||||||
},
|
},
|
||||||
customEqualityTesters = ['a', 'b'],
|
customEqualityTesters = ['a', 'b'],
|
||||||
matcher = j$.matchers.toEqual(util, customEqualityTesters),
|
matcher = j$.matchers.toEqual(util, customEqualityTesters),
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
describe("toHaveBeenCalledWith", function() {
|
describe("toHaveBeenCalledWith", function() {
|
||||||
it("passes when the actual was called with matching parameters", function() {
|
it("passes when the actual was called with matching parameters", function() {
|
||||||
var util = {
|
var util = {
|
||||||
contains: jasmine.createSpy('delegated-contains').and.callReturn(true)
|
contains: jasmine.createSpy('delegated-contains').and.returnValue(true)
|
||||||
},
|
},
|
||||||
matcher = j$.matchers.toHaveBeenCalledWith(util),
|
matcher = j$.matchers.toHaveBeenCalledWith(util),
|
||||||
calledSpy = j$.createSpy('called-spy'),
|
calledSpy = j$.createSpy('called-spy'),
|
||||||
@@ -16,7 +16,7 @@ describe("toHaveBeenCalledWith", function() {
|
|||||||
|
|
||||||
it("fails when the actual was not called", function() {
|
it("fails when the actual was not called", function() {
|
||||||
var util = {
|
var util = {
|
||||||
contains: jasmine.createSpy('delegated-contains').and.callReturn(false)
|
contains: jasmine.createSpy('delegated-contains').and.returnValue(false)
|
||||||
},
|
},
|
||||||
matcher = j$.matchers.toHaveBeenCalledWith(util),
|
matcher = j$.matchers.toHaveBeenCalledWith(util),
|
||||||
uncalledSpy = j$.createSpy('uncalled spy'),
|
uncalledSpy = j$.createSpy('uncalled spy'),
|
||||||
@@ -29,7 +29,7 @@ describe("toHaveBeenCalledWith", function() {
|
|||||||
|
|
||||||
it("fails when the actual was called with different parameters", function() {
|
it("fails when the actual was called with different parameters", function() {
|
||||||
var util = {
|
var util = {
|
||||||
contains: jasmine.createSpy('delegated-contains').and.callReturn(false)
|
contains: jasmine.createSpy('delegated-contains').and.returnValue(false)
|
||||||
},
|
},
|
||||||
matcher = j$.matchers.toHaveBeenCalledWith(util),
|
matcher = j$.matchers.toHaveBeenCalledWith(util),
|
||||||
calledSpy = j$.createSpy('called spy'),
|
calledSpy = j$.createSpy('called spy'),
|
||||||
|
|||||||
@@ -144,7 +144,7 @@ describe("toThrowError", function() {
|
|||||||
|
|
||||||
it("passes if thrown is an Error and the expected the same Error", function() {
|
it("passes if thrown is an Error and the expected the same Error", function() {
|
||||||
var util = {
|
var util = {
|
||||||
equals: jasmine.createSpy('delegated-equal').and.callReturn(true)
|
equals: jasmine.createSpy('delegated-equal').and.returnValue(true)
|
||||||
},
|
},
|
||||||
matcher = j$.matchers.toThrowError(util),
|
matcher = j$.matchers.toThrowError(util),
|
||||||
fn = function() {
|
fn = function() {
|
||||||
@@ -160,7 +160,7 @@ describe("toThrowError", function() {
|
|||||||
|
|
||||||
it("passes if thrown is a custom error that takes arguments and the expected is the same error", function() {
|
it("passes if thrown is a custom error that takes arguments and the expected is the same error", function() {
|
||||||
var util = {
|
var util = {
|
||||||
equals: jasmine.createSpy('delegated-equal').and.callReturn(true)
|
equals: jasmine.createSpy('delegated-equal').and.returnValue(true)
|
||||||
},
|
},
|
||||||
matcher = j$.matchers.toThrowError(util),
|
matcher = j$.matchers.toThrowError(util),
|
||||||
CustomError = function CustomError(arg) { arg.x },
|
CustomError = function CustomError(arg) { arg.x },
|
||||||
@@ -180,7 +180,7 @@ describe("toThrowError", function() {
|
|||||||
|
|
||||||
it("fails if thrown is an Error and the expected is a different Error", function() {
|
it("fails if thrown is an Error and the expected is a different Error", function() {
|
||||||
var util = {
|
var util = {
|
||||||
equals: jasmine.createSpy('delegated-equal').and.callReturn(false)
|
equals: jasmine.createSpy('delegated-equal').and.returnValue(false)
|
||||||
},
|
},
|
||||||
matcher = j$.matchers.toThrowError(util),
|
matcher = j$.matchers.toThrowError(util),
|
||||||
fn = function() {
|
fn = function() {
|
||||||
@@ -196,7 +196,7 @@ describe("toThrowError", function() {
|
|||||||
|
|
||||||
it("passes if thrown is a type of Error and it is equal to the expected Error and message", function() {
|
it("passes if thrown is a type of Error and it is equal to the expected Error and message", function() {
|
||||||
var util = {
|
var util = {
|
||||||
equals: jasmine.createSpy('delegated-equal').and.callReturn(true)
|
equals: jasmine.createSpy('delegated-equal').and.returnValue(true)
|
||||||
},
|
},
|
||||||
matcher = j$.matchers.toThrowError(util),
|
matcher = j$.matchers.toThrowError(util),
|
||||||
fn = function() {
|
fn = function() {
|
||||||
@@ -212,7 +212,7 @@ describe("toThrowError", function() {
|
|||||||
|
|
||||||
it("passes if thrown is a custom error that takes arguments and it is equal to the expected custom error and message", function() {
|
it("passes if thrown is a custom error that takes arguments and it is equal to the expected custom error and message", function() {
|
||||||
var util = {
|
var util = {
|
||||||
equals: jasmine.createSpy('delegated-equal').and.callReturn(true)
|
equals: jasmine.createSpy('delegated-equal').and.returnValue(true)
|
||||||
},
|
},
|
||||||
matcher = j$.matchers.toThrowError(util),
|
matcher = j$.matchers.toThrowError(util),
|
||||||
CustomError = function CustomError(arg) { this.message = arg.message },
|
CustomError = function CustomError(arg) { this.message = arg.message },
|
||||||
@@ -232,7 +232,7 @@ describe("toThrowError", function() {
|
|||||||
|
|
||||||
it("fails if thrown is a type of Error and the expected is a different Error", function() {
|
it("fails if thrown is a type of Error and the expected is a different Error", function() {
|
||||||
var util = {
|
var util = {
|
||||||
equals: jasmine.createSpy('delegated-equal').and.callReturn(false)
|
equals: jasmine.createSpy('delegated-equal').and.returnValue(false)
|
||||||
},
|
},
|
||||||
matcher = j$.matchers.toThrowError(util),
|
matcher = j$.matchers.toThrowError(util),
|
||||||
fn = function() {
|
fn = function() {
|
||||||
@@ -248,7 +248,7 @@ describe("toThrowError", function() {
|
|||||||
|
|
||||||
it("passes if thrown is a type of Error and has the same type as the expected Error and the message matches the exepcted message", function() {
|
it("passes if thrown is a type of Error and has the same type as the expected Error and the message matches the exepcted message", function() {
|
||||||
var util = {
|
var util = {
|
||||||
equals: jasmine.createSpy('delegated-equal').and.callReturn(true)
|
equals: jasmine.createSpy('delegated-equal').and.returnValue(true)
|
||||||
},
|
},
|
||||||
matcher = j$.matchers.toThrowError(util),
|
matcher = j$.matchers.toThrowError(util),
|
||||||
fn = function() {
|
fn = function() {
|
||||||
@@ -264,7 +264,7 @@ describe("toThrowError", function() {
|
|||||||
|
|
||||||
it("fails if thrown is a type of Error and the expected is a different Error", function() {
|
it("fails if thrown is a type of Error and the expected is a different Error", function() {
|
||||||
var util = {
|
var util = {
|
||||||
equals: jasmine.createSpy('delegated-equal').and.callReturn(false)
|
equals: jasmine.createSpy('delegated-equal').and.returnValue(false)
|
||||||
},
|
},
|
||||||
matcher = j$.matchers.toThrowError(util),
|
matcher = j$.matchers.toThrowError(util),
|
||||||
fn = function() {
|
fn = function() {
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ describe("toThrow", function() {
|
|||||||
|
|
||||||
it("passes if it throws but there is no expected", function() {
|
it("passes if it throws but there is no expected", function() {
|
||||||
var util = {
|
var util = {
|
||||||
equals: jasmine.createSpy('delegated-equal').and.callReturn(true)
|
equals: jasmine.createSpy('delegated-equal').and.returnValue(true)
|
||||||
},
|
},
|
||||||
matcher = j$.matchers.toThrow(util),
|
matcher = j$.matchers.toThrow(util),
|
||||||
fn = function() {
|
fn = function() {
|
||||||
@@ -50,7 +50,7 @@ describe("toThrow", function() {
|
|||||||
|
|
||||||
it("passes if what is thrown is equivalent to what is expected", function() {
|
it("passes if what is thrown is equivalent to what is expected", function() {
|
||||||
var util = {
|
var util = {
|
||||||
equals: jasmine.createSpy('delegated-equal').and.callReturn(true)
|
equals: jasmine.createSpy('delegated-equal').and.returnValue(true)
|
||||||
},
|
},
|
||||||
matcher = j$.matchers.toThrow(util),
|
matcher = j$.matchers.toThrow(util),
|
||||||
fn = function() {
|
fn = function() {
|
||||||
@@ -66,7 +66,7 @@ describe("toThrow", function() {
|
|||||||
|
|
||||||
it("fails if what is thrown is not equivalent to what is expected", function() {
|
it("fails if what is thrown is not equivalent to what is expected", function() {
|
||||||
var util = {
|
var util = {
|
||||||
equals: jasmine.createSpy('delegated-equal').and.callReturn(false)
|
equals: jasmine.createSpy('delegated-equal').and.returnValue(false)
|
||||||
},
|
},
|
||||||
matcher = j$.matchers.toThrow(util),
|
matcher = j$.matchers.toThrow(util),
|
||||||
fn = function() {
|
fn = function() {
|
||||||
@@ -82,7 +82,7 @@ describe("toThrow", function() {
|
|||||||
|
|
||||||
it("fails if what is thrown is not equivalent to undefined", function() {
|
it("fails if what is thrown is not equivalent to undefined", function() {
|
||||||
var util = {
|
var util = {
|
||||||
equals: jasmine.createSpy('delegated-equal').and.callReturn(false)
|
equals: jasmine.createSpy('delegated-equal').and.returnValue(false)
|
||||||
},
|
},
|
||||||
matcher = j$.matchers.toThrow(util),
|
matcher = j$.matchers.toThrow(util),
|
||||||
fn = function() {
|
fn = function() {
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ describe("New HtmlReporter", function() {
|
|||||||
|
|
||||||
reporter.jasmineStarted({});
|
reporter.jasmineStarted({});
|
||||||
|
|
||||||
timer.elapsed.and.callReturn(100);
|
timer.elapsed.and.returnValue(100);
|
||||||
reporter.jasmineDone();
|
reporter.jasmineDone();
|
||||||
|
|
||||||
var duration = container.querySelector(".banner .duration");
|
var duration = container.querySelector(".banner .duration");
|
||||||
|
|||||||
@@ -21,14 +21,14 @@ getJasmineRequireObj().SpyStrategy = function() {
|
|||||||
return getSpy();
|
return getSpy();
|
||||||
};
|
};
|
||||||
|
|
||||||
this.callReturn = function(value) {
|
this.returnValue = function(value) {
|
||||||
plan = function() {
|
plan = function() {
|
||||||
return value;
|
return value;
|
||||||
};
|
};
|
||||||
return getSpy();
|
return getSpy();
|
||||||
};
|
};
|
||||||
|
|
||||||
this.callThrow = function(something) {
|
this.throwError = function(something) {
|
||||||
var error = (something instanceof Error) ? something : new Error(something);
|
var error = (something instanceof Error) ? something : new Error(something);
|
||||||
plan = function() {
|
plan = function() {
|
||||||
throw error;
|
throw error;
|
||||||
|
|||||||
Reference in New Issue
Block a user