Skip to content
Browse files

Add teardown methods to Vows contexts.

  • Loading branch information...
1 parent 26129b1 commit a3fea601c5bd1740568a6bf268880d7ec88bc391 @reid reid committed Apr 3, 2012
Showing with 21 additions and 2 deletions.
  1. +7 −1 test/functional.js
  2. +4 −1 test/lib/blizzard-http.js
  3. +4 −0 test/lib/blizzard.js
  4. +3 −0 test/lib/hub.js
  5. +3 −0 test/listen.js
View
8 test/functional.js
@@ -216,6 +216,9 @@ function attachServerContext(testContext, explicitRoute) {
vow.callback(null, server);
});
},
+ teardown: function (server) {
+ server.close();
+ },
"is connected": function (server) {
assert.isNumber(server.address().port);
},
@@ -260,6 +263,10 @@ function attachServerContext(testContext, explicitRoute) {
"used by the Hub Client": {
// TODO: Handle without trailing slash.
topic: hub.clientTopic(route + "/"),
+ teardown: function (topic) {
+ // TODO Add end method, bug #54.
+ // topic.client.end();
+ },
"a browser for testing": {
topic: hub.phantomTopic(),
"visits Yeti": testContext
@@ -270,7 +277,6 @@ function attachServerContext(testContext, explicitRoute) {
}
function attachServerBatch(definition) {
-
var batch = {},
routeWords = ["foo", "bar", "baz", "quux"];
View
5 test/lib/blizzard-http.js
@@ -28,7 +28,10 @@ exports.sessionContext = function (subContext) {
server: serverBlizzardSession
});
});
-
+ },
+ teardown: function (topic) {
+ topic.client.end();
+ topic.server.end();
}
};
View
4 test/lib/blizzard.js
@@ -50,6 +50,10 @@ exports.sessionContext = function (subContext) {
});
clientSocket.once("error", vow.callback);
+ },
+ teardown: function (topic) {
+ topic.client.end();
+ topic.server.end();
}
};
View
3 test/lib/hub.js
@@ -50,6 +50,9 @@ var clientContext = exports.clientContext = function (subContext) {
});
hub.once("error", vow.callback);
},
+ teardown: function (hub) {
+ hub.close();
+ },
"is ok": function (hub) {
assert.ok(hub);
assert.isNumber(hub.server.address().port);
View
3 test/listen.js
@@ -52,6 +52,9 @@ vows.describe("Yeti Listen").addBatch({
vow.callback(null, server);
});
},
+ teardown: function (server) {
+ server.close();
+ },
"is connected": function (topic) {
assert.ok(topic.address().port);
},

0 comments on commit a3fea60

Please sign in to comment.
Something went wrong with that request. Please try again.