Adds back robot-scoped connections by name, and the tests to prove it.
Signed-off-by: deadprogram <ron@hybridgroup.com>
This commit is contained in:
parent
17e9cee6dc
commit
f6be3b1ae3
|
@ -316,6 +316,7 @@ Robot.prototype.startConnection = function(connection, callback) {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.log(str + ".");
|
this.log(str + ".");
|
||||||
|
this[connection.name] = connection;
|
||||||
connection.connect.call(connection, callback);
|
connection.connect.call(connection, callback);
|
||||||
connection.connected = true;
|
connection.connected = true;
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -415,6 +415,13 @@ describe("Robot", function() {
|
||||||
expect(bot.connections.alpha.connect).to.be.called;
|
expect(bot.connections.alpha.connect).to.be.called;
|
||||||
expect(bot.connections.bravo.connect).to.be.called;
|
expect(bot.connections.bravo.connect).to.be.called;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("defines a named connection on robot for each connection", function() {
|
||||||
|
bot.startConnections();
|
||||||
|
|
||||||
|
expect(bot["alpha"]).to.be.an.instanceOf(Adaptor);
|
||||||
|
expect(bot["bravo"]).to.be.an.instanceOf(Adaptor);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("#startDevices", function() {
|
describe("#startDevices", function() {
|
||||||
|
@ -461,6 +468,13 @@ describe("Robot", function() {
|
||||||
expect(bot.devices.bravo.start).to.be.called.once;
|
expect(bot.devices.bravo.start).to.be.called.once;
|
||||||
expect(bot.devices.charlie.start).to.be.called.once;
|
expect(bot.devices.charlie.start).to.be.called.once;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("defines a named device on robot for each device", function() {
|
||||||
|
bot.startDevices();
|
||||||
|
|
||||||
|
expect(bot["alpha"]).to.be.an.instanceOf(Driver);
|
||||||
|
expect(bot["bravo"]).to.be.an.instanceOf(Driver);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("#halt", function() {
|
describe("#halt", function() {
|
||||||
|
|
Loading…
Reference in New Issue