Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

First commit

  • Loading branch information...
commit ca8aa8744a9fba2445c6dbfb323522e92e75721b 0 parents
@dscape authored
4 .gitignore
@@ -0,0 +1,4 @@
+.DS_Store
+node_modules/
+*tmp.*
+*.log
13 LICENSE
@@ -0,0 +1,13 @@
+copyright 2011 nuno job <nunojob.com> (oO)--',--
+
+licensed under the apache license, version 2.0 (the "license");
+you may not use this file except in compliance with the license.
+you may obtain a copy of the license at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+unless required by applicable law or agreed to in writing, software
+distributed under the license is distributed on an "as is" basis,
+without warranties or conditions of any kind, either express or implied.
+see the license for the specific language governing permissions and
+limitations under the license.
24 README.md
@@ -0,0 +1,24 @@
+# ensure
+
+`ensure` is just a simple way to use vows without all the extra stuff
+
+# instalation
+
+1. install [npm][1]
+2. `npm install nano`
+
+# usage
+
+ var ensure = require('../ensure')
+ , assert = require('assert')
+ , tests = exports;
+
+ tests.foo = function (callback) {
+ callback(true);
+ };
+
+ tests.foo_ok = function (t) {
+ assert.ok(t);
+ };
+
+ ensure('foo', tests, module);
18 ensure.js
@@ -0,0 +1,18 @@
+var _ = require('underscore')
+ , vows = require('vows')
+ , assert = require('assert')
+ , batch = {}
+ , f, ok, test_names;
+
+
+module.exports = exports = function(name,tests,module) {
+ test_names = _.filter(_.keys(tests), function(e){ return e.indexOf('_ok') === -1; });
+ _.foldl(test_names, function(memo,e) {
+ t = eval('tests.'+ e);
+ ok = eval('tests.'+ e + '_ok');
+ memo[e] = { topic: function () { t(this.callback); }
+ , ok: ok
+ };
+ return memo; }, batch);
+ vows.describe('foo').addBatch(batch).exportTo(module);
+};
12 package.json
@@ -0,0 +1,12 @@
+{ "name": "ensure"
+, "description": "vows made easy"
+, "homepage": "http://github.com/dscape/ensure"
+, "repository": "git://github.com/dscape/ensure"
+, "version": "0.0.1"
+, "author": "Nuno Job <nunojobpinto@gmail.com> (http://nunojob.com)"
+, "keywords": ["vows", "testing"]
+, "dependencies": {"vows": "~0.5.10", "underscore": "~1.1.7"}
+, "scripts": { "test": "./test/run" }
+, "main": "./ensure.js"
+, "engines" : { "node": ">=0.2.6" }
+}
13 test/foo.js
@@ -0,0 +1,13 @@
+var ensure = require('../ensure')
+ , assert = require('assert')
+ , tests = exports;
+
+tests.foo = function (callback) {
+ callback(true);
+};
+
+tests.foo_ok = function (t) {
+ assert.ok(t);
+};
+
+ensure('foo', tests, module);
7 test/run
@@ -0,0 +1,7 @@
+#!/bin/bash
+# sudo npm install -g vows
+tests=$(dirname $0)
+for s in $(ls -d $tests/);
+do
+ for f in $s*.js; do echo $f; node $f; done;
+done;
Please sign in to comment.
Something went wrong with that request. Please try again.