~caneypuggies/reformedchurcheslocator/couchapp-backbone

« back to all changes in this revision

Viewing changes to _attachments/js/vendor/jasmine/src/core/Block.js

  • Committer: Tim Black
  • Date: 2013-09-16 22:50:16 UTC
  • Revision ID: tim@alwaysreformed.com-20130916225016-zk8jiba25z33ew7h
Versioned Bower vendor directory

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
  if (!jasmine.CATCH_EXCEPTIONS) {
 
17
    this.func.apply(this.spec);
 
18
  }
 
19
  else {
 
20
    try {
 
21
      this.func.apply(this.spec);
 
22
    } catch (e) {
 
23
      this.spec.fail(e);
 
24
    }
 
25
  }
 
26
  onComplete();
 
27
};