Remove extraneous Connection#halt method
This commit is contained in:
parent
897668f3ab
commit
11082b44a9
|
@ -89,17 +89,6 @@ Connection.prototype.initAdaptor = function(opts) {
|
|||
return this.robot.initAdaptor(opts.adaptor, this, opts);
|
||||
};
|
||||
|
||||
// Public: Halt the adaptor's connection
|
||||
//
|
||||
// callback - function to be triggered when the connection has halted
|
||||
//
|
||||
// Returns nothing
|
||||
Connection.prototype.halt = function(callback) {
|
||||
var msg = this._logstring("Halting adaptor");
|
||||
Logger.info(msg);
|
||||
return this.disconnect(callback);
|
||||
};
|
||||
|
||||
Connection.prototype._logstring = function _logstring(action) {
|
||||
var msg = action + " '" + this.name + "'";
|
||||
|
||||
|
|
|
@ -294,7 +294,7 @@ Robot.prototype.halt = function(callback) {
|
|||
|
||||
for (var c in this.connections) {
|
||||
var connection = this.connections[c];
|
||||
fns.push(connection.halt.bind(connection));
|
||||
fns.push(connection.disconnect.bind(connection));
|
||||
}
|
||||
|
||||
Async.parallel(fns, callback);
|
||||
|
|
|
@ -93,27 +93,4 @@ describe("Connection", function() {
|
|||
expect(connection.adaptor.disconnect).to.be.called;
|
||||
});
|
||||
});
|
||||
|
||||
describe("#halt", function() {
|
||||
beforeEach(function() {
|
||||
stub(Logger, 'info').returns(true);
|
||||
stub(connection, 'disconnect').returns(true);
|
||||
|
||||
connection.halt();
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
connection.disconnect.restore();
|
||||
Logger.info.restore();
|
||||
});
|
||||
|
||||
it("logs that it's halting the adaptor", function() {
|
||||
var message = "Halting adaptor 'loopback' on port /dev/null.";
|
||||
expect(Logger.info).to.be.calledWith(message);
|
||||
});
|
||||
|
||||
it("tells the connection to disconnect", function() {
|
||||
expect(connection.disconnect).to.be.called;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -349,19 +349,19 @@ describe("Robot", function() {
|
|||
connection = bot.connections.loopback;
|
||||
|
||||
stub(device, 'halt').returns(true);
|
||||
stub(connection, 'halt').returns(true);
|
||||
stub(connection, 'disconnect').returns(true);
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
device.halt.restore();
|
||||
connection.halt.restore();
|
||||
connection.disconnect.restore();
|
||||
});
|
||||
|
||||
it("calls #halt on all devices and connections", function() {
|
||||
bot.halt();
|
||||
|
||||
expect(device.halt).to.be.called;
|
||||
expect(connection.halt).to.be.called;
|
||||
expect(connection.disconnect).to.be.called;
|
||||
});
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue