Added returnValues functionality to spy strategy

This commit is contained in:
Mridul
2014-09-13 12:41:20 +10:00
parent e8178d061b
commit 709e032d1c
2 changed files with 23 additions and 2 deletions

View File

@@ -1,4 +1,4 @@
getJasmineRequireObj().SpyStrategy = function() {
getJasmineRequireObj().SpyStrategy = function () {
function SpyStrategy(options) {
options = options || {};
@@ -28,7 +28,15 @@ getJasmineRequireObj().SpyStrategy = function() {
return getSpy();
};
this.throwError = function(something) {
this.returnValues = function () {
var values = Array.prototype.slice.call(arguments);
plan = function () {
return values.shift();
};
return getSpy();
};
this.throwError = function (something) {
var error = (something instanceof Error) ? something : new Error(something);
plan = function() {
throw error;