1 /** 2 * Blocks are functions with executable code that make up a spec. 3 * 4 * @constructor 5 * @param {jasmine.Env} env 6 * @param {Function} func 7 * @param {jasmine.Spec} spec 8 */ 9 jasmine.Block = function(env, func, spec) { 10 this.env = env; 11 this.func = func; 12 this.spec = spec; 13 }; 14 15 jasmine.Block.prototype.execute = function(onComplete) { 16 try { 17 if(!this.spec.pending){ 18 this.func.apply(this.spec); 19 } 20 } catch (e) { 21 if(e instanceof jasmine.pending_){ 22 this.spec.pending = true; 23 } else { 24 this.spec.fail(e); 25 } 26 } 27 onComplete(); 28 };