Created
August 20, 2011 14:11
-
-
Save Raynos/1159150 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
["Batch", "Vow", "Context", "Topic", "Suite"].forEach(function(name) { | |
module["create" + name] = function(obj) { | |
return create(module[name]).start(obj); | |
}; | |
exports[name] = module[name]; | |
exports["create" + name] = module["create" + name]; | |
var lowercase = name.charAt(0).toLowerCase() + name.slice(1, name.length); | |
exports[lowercase] = module["create" + name]; | |
}); | |
/* | |
// creates a batch by cloning `Batch` and | |
// starting it. | |
var createBatch = function(suite) { | |
return create(Batch).start(suite); | |
} | |
// Create a context by cloning `Context` and | |
// starting it. | |
var createContext = function(parent) { | |
return create(Context).start(parent); | |
} | |
// Create a Suite by cloning `Suite` and starting | |
// it with `name` | |
var createSuite = function(name) { | |
return create(Suite).start(name); | |
} | |
var createTopic = function(parent) { | |
return create(Topic).start(parent); | |
} | |
var createVow = function(parent) { | |
return create(Vow).start(parent); | |
} | |
// expose objects | |
exports.Vow = Vow; | |
exports.Topic = Topic | |
exports.Context = Context; | |
exports.Batch = Batch; | |
exports.Suite = Suite; | |
exports.context = exports.createContext = createContext; | |
exports.batch = exports.createBatch = createBatch; | |
exports.suite = exports.createSuite = createSuite; | |
exports.topic = exports.createTopic = createTopic; | |
exports.vow = exports.createVow = createVow; | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment