javascript - Jasmine object “has no method 'andReturn'” -
beginner jasmine, first attempt jasmine spies. thought mimicking format displayed here (search: "andreturn"), i'm getting error can't work out: typeerror: object function () { calltracker.track({ object: this, args: array.prototype.slice.apply(arguments) }); return spystrategy.exec.apply(this, arguments); } has no method 'andreturn' no clue i'm doing wrong. here's spec: describe('die', function() { it('returns value when roll it', function() { var die = object.create(die); spyon(math, 'random').andreturn(1); expect(die.roll()).toequal(6); }); }); and corresponding js: var die = { roll: function() { return math.floor(math.random() * 5 + 1); } } thanks help!!! jasmine 2.0 changed of spy syntax. jasmine 2.0 docs spyon(math, 'random').and.returnvalue(1);