Sha256: cc25e6677fe791ea5f00f764193627c5eb0259128a6e2ea872ab4bd2f6bc25bc

Contents?: true

Size: 776 Bytes

Versions: 3

Compression:

Stored size: 776 Bytes

Contents

/**
 * Blocks are functions with executable code that make up a spec.
 *
 * @constructor
 * @param {jasmine.Env} env
 * @param {Function} func
 * @param {jasmine.Spec} spec
 */
jasmine.Block = function(env, func, spec) {
  this.env = env;
  this.func = func;
  this.spec = spec;
};

jasmine.Block.prototype.execute = function(onComplete) {  
  try {
    if(!this.spec.pending ||
       (this.is_after && this.spec.is_before_ran)){
      if(this.is_before){
        this.spec.is_before_ran = true;
      }
      this.func.apply(this.spec);
    }
  } catch (e) {
    if(e instanceof jasmine.pending_){
      this.spec.pending = true;
    } else if (e instanceof jasmine.eventually_){
      throw e;
    } else {
      this.spec && this.spec.fail(e);
    }
  }
  onComplete();
};

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
jazz-0.1.1 vendor/jasmine/src/Block.js
jazrb-0.1.1 vendor/jasmine/src/Block.js
jazrb-0.1.0 vendor/jasmine/src/Block.js