Permalink
Browse files

cleaning

  • Loading branch information...
masylum committed Dec 28, 2010
1 parent 4521ee0 commit ce8b52ed1effe99645a1b012ecfe689ebc6a664f
Showing with 9 additions and 9 deletions.
  1. +9 −9 lib/testosterone.js
View
@@ -12,14 +12,14 @@ module.exports = function (config) {
count_asserts = 0,
passed_asserts = 0,
- _colorize = function (str) {
+ colorize = function (str) {
var colors = { bold: 1, red: 31, green: 32, yellow: 33, grey: 30 };
return str.replace(/\[(\w+)\]\{([^]*?)\}/g, function (_, color, str) {
return '\x1B[' + colors[color] + 'm' + str + '\x1B[0m';
});
},
- _test = function () {
+ test = function () {
if (count_responses === done_responses) {
sys.print(_colorize('\n[grey]{» ' + done_responses + ' responses, ' + passed_asserts + ' asserts}\n'));
process.exit();
@@ -58,7 +58,7 @@ module.exports = function (config) {
* @param {Object|Function} res
*/
- _call = function (req, res, callback) {
+ call = function (req, res, callback) {
// Callback as third or fourth arg
if (typeof res === 'function') {
@@ -130,7 +130,7 @@ module.exports = function (config) {
assert.equal(
response.statusCode,
status,
- _colorize(
+ colorize(
'Invalid response status code.\n' +
' Expected: [green]{' + status + '}\n' +
' Got: [red]{' + response.statusCode + '}'
@@ -150,7 +150,7 @@ module.exports = function (config) {
eql = expected instanceof RegExp ? expected.test(actual) : expected === actual;
assert.ok(
eql,
- _colorize(
+ colorize(
'Invalid response header [bold]{' + name + '}.\n' +
' Expected: [green]{' + expected + '}\n' +
' Got: [red]{' + actual + '}'
@@ -163,7 +163,7 @@ module.exports = function (config) {
// Callback
callback(response);
done_responses += 1;
- _test();
+ test();
});
});
request.end();
@@ -172,21 +172,21 @@ module.exports = function (config) {
['get', 'post'].forEach(function (method) {
testosterone[method] = function (route, req, res, callback) {
count_responses += 1;
- _test();
+ test();
if (typeof req === 'function') {
callback = req;
res = {};
req = {};
}
req.method = method.toUpperCase();
req.url = req.url || route;
- _call(req, res, callback);
+ call(req, res, callback);
return testosterone;
};
});
testosterone.assert = assert;
- sys.print(_colorize('[yellow]{✿ Testosterone}\n'));
+ sys.print(colorize('[yellow]{✿ Testosterone}\n'));
return testosterone;
};

0 comments on commit ce8b52e

Please sign in to comment.