Sha256: 299e92fda645bbcedd34a53f1dc39e3b34c9316a3883751ba2f8e27eb813dde2

Contents?: true

Size: 1.05 KB

Versions: 40

Compression:

Stored size: 1.05 KB

Contents

getJasmineRequireObj().SpyStrategy = function() {

  function SpyStrategy(options) {
    options = options || {};

    var identity = options.name || 'unknown',
        originalFn = options.fn || function() {},
        getSpy = options.getSpy || function() {},
        plan = function() {};

    this.identity = function() {
      return identity;
    };

    this.exec = function() {
      return plan.apply(this, arguments);
    };

    this.callThrough = function() {
      plan = originalFn;
      return getSpy();
    };

    this.returnValue = function(value) {
      plan = function() {
        return value;
      };
      return getSpy();
    };

    this.throwError = function(something) {
      var error = (something instanceof Error) ? something : new Error(something);
      plan = function() {
        throw error;
      };
      return getSpy();
    };

    this.callFake = function(fn) {
      plan = fn;
      return getSpy();
    };

    this.stub = function(fn) {
      plan = function() {};
      return getSpy();
    };
  }

  return SpyStrategy;
};

Version data entries

40 entries across 40 versions & 2 rubygems

Version Path
optimacms-0.1.61 spec/dummy/node_modules/bootstrap-tagsinput/lib/jasmine/src/core/SpyStrategy.js
upjs-rails-0.11.0 spec_app/vendor/assets/bower_components/jasmine/src/core/SpyStrategy.js
upjs-rails-0.10.5 spec_app/vendor/assets/bower_components/jasmine/src/core/SpyStrategy.js
upjs-rails-0.10.4 spec_app/vendor/assets/bower_components/jasmine/src/core/SpyStrategy.js
upjs-rails-0.10.3 spec_app/vendor/assets/bower_components/jasmine/src/core/SpyStrategy.js
upjs-rails-0.10.2 spec_app/vendor/assets/bower_components/jasmine/src/core/SpyStrategy.js
upjs-rails-0.10.1 spec_app/vendor/assets/bower_components/jasmine/src/core/SpyStrategy.js
upjs-rails-0.10.0 spec_app/vendor/assets/bower_components/jasmine/src/core/SpyStrategy.js
upjs-rails-0.9.1 spec_app/vendor/assets/bower_components/jasmine/src/core/SpyStrategy.js
upjs-rails-0.9.0 spec_app/vendor/assets/bower_components/jasmine/src/core/SpyStrategy.js
upjs-rails-0.8.2 spec_app/vendor/assets/bower_components/jasmine/src/core/SpyStrategy.js
upjs-rails-0.8.1 spec_app/vendor/assets/bower_components/jasmine/src/core/SpyStrategy.js
upjs-rails-0.8.0 spec_app/vendor/assets/bower_components/jasmine/src/core/SpyStrategy.js
upjs-rails-0.7.8 spec_app/vendor/assets/bower_components/jasmine/src/core/SpyStrategy.js
upjs-rails-0.7.7 spec_app/vendor/assets/bower_components/jasmine/src/core/SpyStrategy.js
upjs-rails-0.7.6 spec_app/vendor/assets/bower_components/jasmine/src/core/SpyStrategy.js
upjs-rails-0.7.5 spec_app/vendor/assets/bower_components/jasmine/src/core/SpyStrategy.js
upjs-rails-0.7.4 spec_app/vendor/assets/bower_components/jasmine/src/core/SpyStrategy.js
upjs-rails-0.7.3 spec_app/vendor/assets/bower_components/jasmine/src/core/SpyStrategy.js
upjs-rails-0.7.2 spec_app/vendor/assets/bower_components/jasmine/src/core/SpyStrategy.js