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 this.func.apply(this.spec); 18 } catch (e) { 19 this.spec.fail(e); 20 } 21 onComplete(); 22 };