diff --git a/lib/jasmine-core/jasmine.js b/lib/jasmine-core/jasmine.js index 240ae3f9..820f8031 100644 --- a/lib/jasmine-core/jasmine.js +++ b/lib/jasmine-core/jasmine.js @@ -1557,14 +1557,14 @@ getJasmineRequireObj().SpyStrategy = function() { return getSpy(); }; - this.callReturn = function(value) { + this.returnValue = function(value) { plan = function() { return value; }; return getSpy(); }; - this.callThrow = function(something) { + this.throwError = function(something) { var error = (something instanceof Error) ? something : new Error(something); plan = function() { throw error; diff --git a/spec/console/ConsoleReporterSpec.js b/spec/console/ConsoleReporterSpec.js index 5ca843a8..0749260a 100644 --- a/spec/console/ConsoleReporterSpec.js +++ b/spec/console/ConsoleReporterSpec.js @@ -90,7 +90,7 @@ describe("ConsoleReporter", function() { reporter.jasmineStarted(); reporter.specDone({status: "passed"}); - timerSpy.elapsed.and.callReturn(1000); + timerSpy.elapsed.and.returnValue(1000); out.clear(); reporter.jasmineDone(); @@ -127,7 +127,7 @@ describe("ConsoleReporter", function() { out.clear(); - timerSpy.elapsed.and.callReturn(100); + timerSpy.elapsed.and.returnValue(100); reporter.jasmineDone(); diff --git a/spec/core/ClockSpec.js b/spec/core/ClockSpec.js index c17c5a7b..c49a25b7 100644 --- a/spec/core/ClockSpec.js +++ b/spec/core/ClockSpec.js @@ -131,7 +131,7 @@ describe("Clock", function() { it("returns an id for the delayed function", function() { var fakeSetTimeout = jasmine.createSpy('setTimeout'), scheduleId = 123, - scheduleFunction = jasmine.createSpy('scheduleFunction').and.callReturn(scheduleId), + scheduleFunction = jasmine.createSpy('scheduleFunction').and.returnValue(scheduleId), delayedFunctionScheduler = {scheduleFunction: scheduleFunction}, fakeGlobal = { setTimeout: fakeSetTimeout }, delayedFn = jasmine.createSpy('delayedFn'), @@ -176,7 +176,7 @@ describe("Clock", function() { it("returns an id for the delayed function", function() { var fakeSetInterval = jasmine.createSpy('setInterval'), scheduleId = 123, - scheduleFunction = jasmine.createSpy('scheduleFunction').and.callReturn(scheduleId), + scheduleFunction = jasmine.createSpy('scheduleFunction').and.returnValue(scheduleId), delayedFunctionScheduler = {scheduleFunction: scheduleFunction}, fakeGlobal = { setInterval: fakeSetInterval }, delayedFn = jasmine.createSpy('delayedFn'), diff --git a/spec/core/ExpectationResultSpec.js b/spec/core/ExpectationResultSpec.js index 21f4d98c..dc000cdd 100644 --- a/spec/core/ExpectationResultSpec.js +++ b/spec/core/ExpectationResultSpec.js @@ -16,7 +16,7 @@ describe("buildExpectationResult", function() { it("delegates message formatting to the provided formatter if there was an Error", function() { 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( { @@ -31,7 +31,7 @@ describe("buildExpectationResult", function() { it("delegates stack formatting to the provided formatter if there was an Error", function() { 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( { diff --git a/spec/core/ExpectationSpec.js b/spec/core/ExpectationSpec.js index d886e7f4..a86c4f66 100644 --- a/spec/core/ExpectationSpec.js +++ b/spec/core/ExpectationSpec.js @@ -56,7 +56,7 @@ describe("Expectation", function() { it("wraps matchers's compare functions, passing in matcher dependencies", function() { var fakeCompare = function() { return { pass: true }; }, - matcherFactory = jasmine.createSpy("matcher").and.callReturn({ compare: fakeCompare }), + matcherFactory = jasmine.createSpy("matcher").and.returnValue({ compare: fakeCompare }), matchers = { toFoo: matcherFactory }, @@ -80,7 +80,7 @@ describe("Expectation", 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 = { toFoo: function() { return { diff --git a/spec/core/JsApiReporterSpec.js b/spec/core/JsApiReporterSpec.js index 47e1e365..827b0dba 100644 --- a/spec/core/JsApiReporterSpec.js +++ b/spec/core/JsApiReporterSpec.js @@ -196,7 +196,7 @@ describe("JsApiReporter", function() { timer: timerSpy }); - timerSpy.elapsed.and.callReturn(1000); + timerSpy.elapsed.and.returnValue(1000); reporter.jasmineDone(); expect(reporter.executionTime()).toEqual(1000); }); diff --git a/spec/core/SpyStrategySpec.js b/spec/core/SpyStrategySpec.js index 496c8b73..3fc32a37 100644 --- a/spec/core/SpyStrategySpec.js +++ b/spec/core/SpyStrategySpec.js @@ -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() { - var originalFn = jasmine.createSpy("original").and.callReturn(42), + var originalFn = jasmine.createSpy("original").and.returnValue(42), spyStrategy = new j$.SpyStrategy({fn: originalFn}), returnValue; @@ -39,7 +39,7 @@ describe("SpyStrategy", function() { spyStrategy = new j$.SpyStrategy({fn: originalFn}), returnValue; - spyStrategy.callReturn(17); + spyStrategy.returnValue(17); returnValue = spyStrategy.exec(); expect(originalFn).not.toHaveBeenCalled(); @@ -50,7 +50,7 @@ describe("SpyStrategy", function() { var originalFn = jasmine.createSpy("original"), spyStrategy = new j$.SpyStrategy({fn: originalFn}); - spyStrategy.callThrow(new TypeError("bar")); + spyStrategy.throwError(new TypeError("bar")); expect(function() { spyStrategy.exec(); }).toThrowError(TypeError, "bar"); expect(originalFn).not.toHaveBeenCalled(); @@ -60,7 +60,7 @@ describe("SpyStrategy", function() { var originalFn = jasmine.createSpy("original"), spyStrategy = new j$.SpyStrategy({fn: originalFn}); - spyStrategy.callThrow("bar"); + spyStrategy.throwError("bar"); expect(function() { spyStrategy.exec(); }).toThrowError(Error, "bar"); expect(originalFn).not.toHaveBeenCalled(); @@ -68,7 +68,7 @@ describe("SpyStrategy", function() { it("allows a fake function to be called instead", function() { 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}), returnValue; @@ -81,7 +81,7 @@ describe("SpyStrategy", function() { it("allows a return to plan stubbing after another strategy", function() { 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}), returnValue; @@ -99,12 +99,12 @@ describe("SpyStrategy", function() { it("returns the spy after changing the strategy", function(){ var spy = {}, - spyFn = jasmine.createSpy('spyFn').and.callReturn(spy), + spyFn = jasmine.createSpy('spyFn').and.returnValue(spy), spyStrategy = new j$.SpyStrategy({getSpy: spyFn}); expect(spyStrategy.callThrough()).toBe(spy); - expect(spyStrategy.callReturn()).toBe(spy); - expect(spyStrategy.callThrow()).toBe(spy); + expect(spyStrategy.returnValue()).toBe(spy); + expect(spyStrategy.throwError()).toBe(spy); expect(spyStrategy.callFake()).toBe(spy); expect(spyStrategy.stub()).toBe(spy); }); diff --git a/spec/core/TimerSpec.js b/spec/core/TimerSpec.js index 589ed92a..62312c47 100644 --- a/spec/core/TimerSpec.js +++ b/spec/core/TimerSpec.js @@ -3,10 +3,10 @@ describe("Timer", function() { var fakeNow = jasmine.createSpy('fake Date.now'), timer = new j$.Timer({now: fakeNow}); - fakeNow.and.callReturn(100); + fakeNow.and.returnValue(100); timer.start(); - fakeNow.and.callReturn(200); + fakeNow.and.returnValue(200); expect(timer.elapsed()).toEqual(100); }); diff --git a/spec/core/matchers/toContainSpec.js b/spec/core/matchers/toContainSpec.js index fb3203dd..848a73dc 100644 --- a/spec/core/matchers/toContainSpec.js +++ b/spec/core/matchers/toContainSpec.js @@ -1,7 +1,7 @@ describe("toContain", function() { it("delegates to j$.matchersUtil.contains", function() { var util = { - contains: jasmine.createSpy('delegated-contains').and.callReturn(true) + contains: jasmine.createSpy('delegated-contains').and.returnValue(true) }, 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() { var util = { - contains: jasmine.createSpy('delegated-contains').and.callReturn(true) + contains: jasmine.createSpy('delegated-contains').and.returnValue(true) }, customEqualityTesters = ['a', 'b'], matcher = j$.matchers.toContain(util, customEqualityTesters); diff --git a/spec/core/matchers/toEqualSpec.js b/spec/core/matchers/toEqualSpec.js index ed7e92a7..55bfee12 100644 --- a/spec/core/matchers/toEqualSpec.js +++ b/spec/core/matchers/toEqualSpec.js @@ -1,7 +1,7 @@ describe("toEqual", function() { it("delegates to equals function", function() { var util = { - equals: jasmine.createSpy('delegated-equals').and.callReturn(true) + equals: jasmine.createSpy('delegated-equals').and.returnValue(true) }, matcher = j$.matchers.toEqual(util), result; @@ -14,7 +14,7 @@ describe("toEqual", function() { it("delegates custom equality testers, if present", function() { var util = { - equals: jasmine.createSpy('delegated-equals').and.callReturn(true) + equals: jasmine.createSpy('delegated-equals').and.returnValue(true) }, customEqualityTesters = ['a', 'b'], matcher = j$.matchers.toEqual(util, customEqualityTesters), diff --git a/spec/core/matchers/toHaveBeenCalledWithSpec.js b/spec/core/matchers/toHaveBeenCalledWithSpec.js index 3e6a35a6..466682cd 100644 --- a/spec/core/matchers/toHaveBeenCalledWithSpec.js +++ b/spec/core/matchers/toHaveBeenCalledWithSpec.js @@ -1,7 +1,7 @@ describe("toHaveBeenCalledWith", function() { it("passes when the actual was called with matching parameters", function() { var util = { - contains: jasmine.createSpy('delegated-contains').and.callReturn(true) + contains: jasmine.createSpy('delegated-contains').and.returnValue(true) }, matcher = j$.matchers.toHaveBeenCalledWith(util), calledSpy = j$.createSpy('called-spy'), @@ -16,7 +16,7 @@ describe("toHaveBeenCalledWith", function() { it("fails when the actual was not called", function() { var util = { - contains: jasmine.createSpy('delegated-contains').and.callReturn(false) + contains: jasmine.createSpy('delegated-contains').and.returnValue(false) }, matcher = j$.matchers.toHaveBeenCalledWith(util), uncalledSpy = j$.createSpy('uncalled spy'), @@ -29,7 +29,7 @@ describe("toHaveBeenCalledWith", function() { it("fails when the actual was called with different parameters", function() { var util = { - contains: jasmine.createSpy('delegated-contains').and.callReturn(false) + contains: jasmine.createSpy('delegated-contains').and.returnValue(false) }, matcher = j$.matchers.toHaveBeenCalledWith(util), calledSpy = j$.createSpy('called spy'), diff --git a/spec/core/matchers/toThrowErrorSpec.js b/spec/core/matchers/toThrowErrorSpec.js index ac7eb279..a6391f0a 100644 --- a/spec/core/matchers/toThrowErrorSpec.js +++ b/spec/core/matchers/toThrowErrorSpec.js @@ -144,7 +144,7 @@ describe("toThrowError", function() { it("passes if thrown is an Error and the expected the same Error", function() { var util = { - equals: jasmine.createSpy('delegated-equal').and.callReturn(true) + equals: jasmine.createSpy('delegated-equal').and.returnValue(true) }, matcher = j$.matchers.toThrowError(util), 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() { var util = { - equals: jasmine.createSpy('delegated-equal').and.callReturn(true) + equals: jasmine.createSpy('delegated-equal').and.returnValue(true) }, matcher = j$.matchers.toThrowError(util), 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() { var util = { - equals: jasmine.createSpy('delegated-equal').and.callReturn(false) + equals: jasmine.createSpy('delegated-equal').and.returnValue(false) }, matcher = j$.matchers.toThrowError(util), 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() { var util = { - equals: jasmine.createSpy('delegated-equal').and.callReturn(true) + equals: jasmine.createSpy('delegated-equal').and.returnValue(true) }, matcher = j$.matchers.toThrowError(util), 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() { var util = { - equals: jasmine.createSpy('delegated-equal').and.callReturn(true) + equals: jasmine.createSpy('delegated-equal').and.returnValue(true) }, matcher = j$.matchers.toThrowError(util), 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() { var util = { - equals: jasmine.createSpy('delegated-equal').and.callReturn(false) + equals: jasmine.createSpy('delegated-equal').and.returnValue(false) }, matcher = j$.matchers.toThrowError(util), 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() { var util = { - equals: jasmine.createSpy('delegated-equal').and.callReturn(true) + equals: jasmine.createSpy('delegated-equal').and.returnValue(true) }, matcher = j$.matchers.toThrowError(util), 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() { var util = { - equals: jasmine.createSpy('delegated-equal').and.callReturn(false) + equals: jasmine.createSpy('delegated-equal').and.returnValue(false) }, matcher = j$.matchers.toThrowError(util), fn = function() { diff --git a/spec/core/matchers/toThrowSpec.js b/spec/core/matchers/toThrowSpec.js index e1e043ea..0f16673a 100644 --- a/spec/core/matchers/toThrowSpec.js +++ b/spec/core/matchers/toThrowSpec.js @@ -22,7 +22,7 @@ describe("toThrow", function() { it("passes if it throws but there is no expected", function() { var util = { - equals: jasmine.createSpy('delegated-equal').and.callReturn(true) + equals: jasmine.createSpy('delegated-equal').and.returnValue(true) }, matcher = j$.matchers.toThrow(util), fn = function() { @@ -50,7 +50,7 @@ describe("toThrow", function() { it("passes if what is thrown is equivalent to what is expected", function() { var util = { - equals: jasmine.createSpy('delegated-equal').and.callReturn(true) + equals: jasmine.createSpy('delegated-equal').and.returnValue(true) }, matcher = j$.matchers.toThrow(util), fn = function() { @@ -66,7 +66,7 @@ describe("toThrow", function() { it("fails if what is thrown is not equivalent to what is expected", function() { var util = { - equals: jasmine.createSpy('delegated-equal').and.callReturn(false) + equals: jasmine.createSpy('delegated-equal').and.returnValue(false) }, matcher = j$.matchers.toThrow(util), fn = function() { @@ -82,7 +82,7 @@ describe("toThrow", function() { it("fails if what is thrown is not equivalent to undefined", function() { var util = { - equals: jasmine.createSpy('delegated-equal').and.callReturn(false) + equals: jasmine.createSpy('delegated-equal').and.returnValue(false) }, matcher = j$.matchers.toThrow(util), fn = function() { diff --git a/spec/html/HtmlReporterSpec.js b/spec/html/HtmlReporterSpec.js index 2e9f7a38..ab57b038 100644 --- a/spec/html/HtmlReporterSpec.js +++ b/spec/html/HtmlReporterSpec.js @@ -148,7 +148,7 @@ describe("New HtmlReporter", function() { reporter.jasmineStarted({}); - timer.elapsed.and.callReturn(100); + timer.elapsed.and.returnValue(100); reporter.jasmineDone(); var duration = container.querySelector(".banner .duration"); diff --git a/src/core/SpyStrategy.js b/src/core/SpyStrategy.js index fc6bb9fc..819d8ce2 100644 --- a/src/core/SpyStrategy.js +++ b/src/core/SpyStrategy.js @@ -21,14 +21,14 @@ getJasmineRequireObj().SpyStrategy = function() { return getSpy(); }; - this.callReturn = function(value) { + this.returnValue = function(value) { plan = function() { return value; }; return getSpy(); }; - this.callThrow = function(something) { + this.throwError = function(something) { var error = (something instanceof Error) ? something : new Error(something); plan = function() { throw error;