Activate your free membership today | Log-in

Friday, April 20th, 2007

Specifications: BDD Framework

Category: JavaScript, Library

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

Posted by Dion Almaer at 6:26 am

++---
2.6 rating from 14 votes

1 Comment »

Comments feed TrackBack URI

The link to specifications has changed:

http://dev.zeraweb.com/specifications

Comment by Harvey — August 20, 2007

Leave a comment

You must be logged in to post a comment.