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
upjs-rails-0.7.1 spec_app/vendor/assets/bower_components/jasmine/src/core/SpyStrategy.js
upjs-rails-0.7.0 spec_app/vendor/assets/bower_components/jasmine/src/core/SpyStrategy.js
upjs-rails-0.6.5 spec_app/vendor/assets/bower_components/jasmine/src/core/SpyStrategy.js
upjs-rails-0.6.4 spec_app/vendor/assets/bower_components/jasmine/src/core/SpyStrategy.js
upjs-rails-0.6.3 spec_app/vendor/assets/bower_components/jasmine/src/core/SpyStrategy.js
upjs-rails-0.6.2 spec_app/vendor/assets/bower_components/jasmine/src/core/SpyStrategy.js
upjs-rails-0.6.1 spec_app/vendor/assets/bower_components/jasmine/src/core/SpyStrategy.js
upjs-rails-0.6.0 spec_app/vendor/assets/bower_components/jasmine/src/core/SpyStrategy.js
upjs-rails-0.5.0 spec_app/vendor/assets/bower_components/jasmine/src/core/SpyStrategy.js
upjs-rails-0.4.4 spec_app/vendor/assets/bower_components/jasmine/src/core/SpyStrategy.js
upjs-rails-0.4.3 spec_app/vendor/assets/bower_components/jasmine/src/core/SpyStrategy.js
upjs-rails-0.4.2 spec_app/vendor/assets/bower_components/jasmine/src/core/SpyStrategy.js
upjs-rails-0.4.1 spec_app/vendor/assets/bower_components/jasmine/src/core/SpyStrategy.js
upjs-rails-0.4.0 spec_app/vendor/assets/bower_components/jasmine/src/core/SpyStrategy.js
upjs-rails-0.3.3 spec_app/vendor/assets/bower_components/jasmine/src/core/SpyStrategy.js
upjs-rails-0.3.2 spec_app/vendor/assets/bower_components/jasmine/src/core/SpyStrategy.js
upjs-rails-0.3.0 spec_app/vendor/assets/bower_components/jasmine/src/core/SpyStrategy.js
upjs-rails-0.2.2 spec_app/vendor/assets/bower_components/jasmine/src/core/SpyStrategy.js
upjs-rails-0.2.1 spec_app/vendor/assets/bower_components/jasmine/src/core/SpyStrategy.js
upjs-rails-0.2.0 spec_app/vendor/assets/bower_components/jasmine/src/core/SpyStrategy.js