Day: December 21, 2007
js-spec
js-spec: Want to do BDD in Javascript? This aims to clone rspec (http://rspec.rubyforge.org) in javascript.
For now it's very basic, but stuff like the following works.
describe("A newly created Tic-Tac-Toe", function() {
with (this) {
before("each", function() {
this.game = new TicTacToe();
});
it("should have 9 empty cells", function() {
game.cells.should( have(9, "items") );
game.cells.each(function(cell) {
cell.should( be(undefined) );
});
});
it("should have 0 players", function() {
game.should( have(0, "players") );
});
}
});
Stay tuned for more :)
Ask questions, make suggestions and post bugs at http://code.google.com/p/js-spec/issues/ [Nice to see BDD spreading…]
Source: Scripteka