Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Got vows tests working with teardown, so now the tests exit cleanly b…
…y closing the Redis connections from any open Clients. Added a Makefile to make running tests less verbose to invoke.
- Loading branch information
Showing
11 changed files
with
112 additions
and
60 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,9 @@ | |||
|
|||
VOWS = vows --spec | |||
|
|||
TESTS = test/*.vows.js | |||
|
|||
test: | |||
@$(VOWS) $(TESTS) | |||
|
|||
.PHONY: test |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,21 +1,35 @@ | |||
var redis = require("../lib/redis"); | var redis = require("../lib/redis"); | ||
var client = redis.createClient(); | |||
client.select(6); | |||
client.flushdb(); | |||
var setupClient = function () { | |||
client.select(6); | |||
return client; | |||
}; | |||
|
|
||
exports.usingClient = function (subContexts) { |
|
||
var context = {topic: setupClient}; | var usingClient = exports.usingClient = function (client, subContexts) { | ||
var currSubContext; | return function (subContexts) { | ||
if (subContexts.hasOwnProperty("topic")) { | function setupClient () { | ||
context[""] = subContexts; | client.select(6); | ||
} else { | client.remainingTests++; | ||
for (var subContextName in subContexts) { | return client; | ||
context[subContextName] = subContexts[subContextName]; | } | ||
function teardown () { | |||
if (--client.remainingTests === 0) { | |||
client.close(); | |||
} | |||
} | } | ||
} | var context = {topic: setupClient, teardown: teardown}; | ||
return context; | var currSubContext; | ||
if (subContexts.hasOwnProperty("topic")) { | |||
context[""] = subContexts; | |||
} else { | |||
for (var subContextName in subContexts) { | |||
context[subContextName] = subContexts[subContextName]; | |||
} | |||
} | |||
return context; | |||
}; | |||
}; | |||
|
|||
usingClient.gen = function (subContexts) { | |||
var client = redis.createClient(); | |||
client.select(6); | |||
client.flushdb(); | |||
client.remainingTests = 0; | |||
return usingClient(client, subContexts); | |||
}; | }; |
This file contains 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