Specifications: BDD Framework
Written by on April 20th, 2007 in Ajax News.
Dan Yoder has released Specifications, a BDD framework built on top of Prototype.
This is different to the builtin framework that comes with Script.aculo.us.
You write a spec such as:
JAVASCRIPT:
-
-
Stack.Specification = new Specification({
-
“A stack should”: {
-
setup: function() {
-
this.stack = new Stack();
-
this.stack.push(’a').push(’b').push(’c');
-
},
-
‘add to the top using push.’: {
-
run: function() { this.stack.push(’d') },
-
assert: function() { return this.stack.peek()==’d’ }
-
},
-
‘return the top using peek.’: {
-
run: function() {},
-
assert: function() { return this.stack.peek()==’c’ }
-
}
-
// etc.
-
}
-
});
-
Source: Ajaxian
Original Article: http://ajaxian.com/archives/specifications-bdd-framework
