diff --git a/lib/robot.js b/lib/robot.js index c65b6cd..22fba1a 100644 --- a/lib/robot.js +++ b/lib/robot.js @@ -292,12 +292,16 @@ Robot.prototype.halt = function(callback) { fns.push(device.halt.bind(device)); } - for (var c in this.connections) { - var connection = this.connections[c]; - fns.push(connection.disconnect.bind(connection)); - } + Async.parallel(fns, function() { + var fns = []; - Async.parallel(fns, callback); + for (var c in this.connections) { + var connection = this.connections[c]; + fns.push(connection.disconnect.bind(connection)); + } + + Async.parallel(fns, callback); + }.bind(this)); }; // Public: Initialize an adaptor and adds it to @robot.adaptors @@ -323,6 +327,7 @@ Robot.prototype.initAdaptor = function(adaptorName, connection, opts) { connection: connection, extraParams: opts }); + return Utils.proxyTestStubs(adaptor.commands, testAdaptor); for (var prop in adaptor) { diff --git a/test/specs/robot.spec.js b/test/specs/robot.spec.js index 67ff756..afe2c2c 100644 --- a/test/specs/robot.spec.js +++ b/test/specs/robot.spec.js @@ -348,8 +348,8 @@ describe("Robot", function() { device = bot.devices.ping; connection = bot.connections.loopback; - stub(device, 'halt').returns(true); - stub(connection, 'disconnect').returns(true); + stub(device, 'halt').yields(true); + stub(connection, 'disconnect').yields(true); }); afterEach(function() {