Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
eugeneware committed Feb 11, 2011
0 parents commit 844069d
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
@@ -0,0 +1,2 @@
*.swp
.DS_Store
19 changes: 19 additions & 0 deletions lib/expressobdd.js
@@ -0,0 +1,19 @@
module.exports = function(tests) {
var results = {};

function parse(tests, prefix) {
for (var i in tests) {
if (tests[i] instanceof Function) {
results[(prefix.length ? ('[' + prefix.join('][') + ']: ') : '') + i] = tests[i];
} else {
parse(tests[i], prefix.concat([i]));
}
}
}

parse(tests, []);

console.log(results);

return results;
};
13 changes: 13 additions & 0 deletions package.json
@@ -0,0 +1,13 @@
{
"name" : "expressobdd",
"version" : "v1.0.0",
"description" : "Add basic multilevel describe/it bdd constructs to expresso",
"homepage" : "http://github.com/nharbour/expressobdd",
"keywords" : ["expresso", "expressobdd", "bdd", "test", "testing", "tests"],
"author" : "Eugene Ware <eugene@noblesamurai.com>",
"maintainers" : ["Eugene Ware <eugene@noblesamurai.com>"],
"licenses" : ["MIT"],
"dependencies" : {"expresso": ">=0.7.2", "should": ">=0.0.4"},
"main" : "./lib/expressobdd",
"repository" : { "type": "git", "url": "http://github.com/nharbour/expressobdd.git" }
}
26 changes: 26 additions & 0 deletions test/expressobdd.test.js
@@ -0,0 +1,26 @@
require('should');

module.exports = require('../lib/expressobdd')({
'group one': {
'it should do x': function() {
var x = 2;
x.should.eql(2);
},

'it should do y': function() {
var y = 3;
y.should.eql(3);
},

'group one point 2': {
'it should do w': function() {
var z = 5;
z.should.eql(6);
},
},
},
'it should do z': function() {
var z = 4;
z.should.eql(4);
},
});

0 comments on commit 844069d

Please sign in to comment.