aboutsummaryrefslogtreecommitdiffstats
path: root/src/scenario/Runner.js
diff options
context:
space:
mode:
authorAndres Ornelas2010-06-09 16:05:51 -0700
committerAndres Ornelas2010-06-09 16:05:51 -0700
commitbbb45a7eed5264a343c191f3abfbe6f6b5d51139 (patch)
tree340453d4268200f36a7934274450502145e123cf /src/scenario/Runner.js
parent36b58b235eeca4e9580162a697d8a96c41263ebc (diff)
parentd0a468153d98c892323cb135b509cb46f67e44fd (diff)
downloadangular.js-bbb45a7eed5264a343c191f3abfbe6f6b5d51139.tar.bz2
Merge branch 'repeater'
Diffstat (limited to 'src/scenario/Runner.js')
-rw-r--r--src/scenario/Runner.js15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/scenario/Runner.js b/src/scenario/Runner.js
index da6e2c39..8e0cc909 100644
--- a/src/scenario/Runner.js
+++ b/src/scenario/Runner.js
@@ -8,23 +8,34 @@ angular.scenario.Runner = function(scope, jQuery){
var specs = this.specs = {};
var path = [];
- this.scope.describe = function describe(name, body){
+ this.scope.describe = function(name, body){
path.push(name);
body();
path.pop();
};
- this.scope.it = function it(name, body) {
+ var beforeEach = noop;
+ var afterEach = noop;
+ this.scope.beforeEach = function(body) {
+ beforeEach = body;
+ };
+ this.scope.afterEach = function(body) {
+ afterEach = body;
+ };
+ this.scope.it = function(name, body) {
var specName = path.join(' ') + ': it ' + name;
self.currentSpec = specs[specName] = {
name: specName,
steps:[]
};
try {
+ beforeEach();
body();
} catch(err) {
self.addStep(err.message || 'ERROR', function(){
throw err;
});
+ } finally {
+ afterEach();
}
self.currentSpec = null;
};