Squashed spy refactor and new spy syntax

Jasmine spies now have a 'and' property which allows the user to
change the spy's execution strategy-- such as '.and.callReturn(4)'
and a 'calls' property which allows inspection of the calls a spy
has received.

* This is a breaking change *

There is a CallTracker that keeps track of all calls and arguments
and a SpyStrategy which determines what the spy should do when it
is called.
This commit is contained in:
Davis W. Frank & Sheel Choksi
2013-07-17 23:11:55 -07:00
committed by Colin O'Byrne and JR Boyens
parent 18c30566bd
commit 3847557bbc
32 changed files with 692 additions and 413 deletions

View File

@@ -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').andReturn(true)
equals: jasmine.createSpy('delegated-equal').and.callReturn(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').andReturn(true)
equals: jasmine.createSpy('delegated-equal').and.callReturn(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').andReturn(false)
equals: jasmine.createSpy('delegated-equal').and.callReturn(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').andReturn(false)
equals: jasmine.createSpy('delegated-equal').and.callReturn(false)
},
matcher = j$.matchers.toThrow(util),
fn = function() {