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:

  1.  
  2. Stack.Specification = new Specification({
  3.   “A stack should”: {
  4.     setup: function() {
  5.       this.stack = new Stack();
  6.       this.stack.push(’a').push(’b').push(’c');
  7.     },
  8.     ‘add to the top using push.’: {
  9.       run: function() { this.stack.push(’d') },
  10.       assert: function() { return this.stack.peek()==’d’ }
  11.     },
  12.     ‘return the top using peek.’: {
  13.       run: function() {},
  14.       assert: function() { return this.stack.peek()==’c’ }
  15.     }
  16.     // etc.
  17.   }
  18. });
  19.  

Specifications

Source: Ajaxian
Original Article: http://ajaxian.com/archives/specifications-bdd-framework

Leave a Reply

You must be logged in to post a comment.



Site Navigation