runner-wide beforeEach, afterEach support

This commit is contained in:
ragaskar
2009-09-28 16:23:21 -07:00
parent 2588368231
commit a394b564f4
26 changed files with 1659 additions and 1436 deletions
+13
View File
@@ -8,6 +8,8 @@ jasmine.Runner = function(env) {
var self = this;
self.env = env;
self.queue = new jasmine.Queue(env);
self.before_ = [];
self.after_ = [];
self.suites_ = [];
};
@@ -21,6 +23,17 @@ jasmine.Runner.prototype.execute = function() {
});
};
jasmine.Runner.prototype.beforeEach = function(beforeEachFunction) {
beforeEachFunction.typeName = 'beforeEach';
this.before_.push(beforeEachFunction);
};
jasmine.Runner.prototype.afterEach = function(afterEachFunction) {
afterEachFunction.typeName = 'afterEach';
this.after_.push(afterEachFunction);
};
jasmine.Runner.prototype.finishCallback = function() {
this.env.reporter.reportRunnerResults(this);
};