You can use spy.and.returnValues (as Jasmine 2.4).
for example
describe("A spy, when configured to fake a series of return values", function() {
beforeEach(function() {
spyOn(util, "foo").and.returnValues(true, false);
});
it("when called multiple times returns the requested values in order", function() {
expect(util.foo()).toBeTruthy();
expect(util.foo()).toBeFalsy();
expect(util.foo()).toBeUndefined();
});
});
However, there is something you must be careful about. There is another function with a similar spelling: returnValue without s. If you use that, Jasmine will not warn you, but it will behave differently.