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. Stack.Specification = new Specification({
  2.   "A stack should": {
  3.     setup: function() {
  4.       this.stack = new Stack();
  5.       this.stack.push('a').push('b').push('c');
  6.     },
  7.     'add to the top using push.': {
  8.       run: function() { this.stack.push('d') },
  9.       assert: function() { return this.stack.peek()=='d' }
  10.     },
  11.     'return the top using peek.': {
  12.       run: function() {},
  13.       assert: function() { return this.stack.peek()=='c' }
  14.     }
  15.     // etc.
  16.   }
  17. });

Specifications

Posted by Dion Almaer at 6:26 am
1 Comment

++---
2.7 rating from 19 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.