Permalink
Browse files

Initial Commit

  • Loading branch information...
0 parents commit 844069d1aa6945b78823c6ddba19b3f25bdcbc97 @eugeneware committed Feb 11, 2011
Showing with 60 additions and 0 deletions.
  1. +2 −0 .gitignore
  2. +19 −0 lib/expressobdd.js
  3. +13 −0 package.json
  4. +26 −0 test/expressobdd.test.js
2 .gitignore
@@ -0,0 +1,2 @@
+*.swp
+.DS_Store
19 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 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 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.