Refer to device connections by name in JSON format

This commit is contained in:
Andrew Stewart 2014-07-15 11:49:29 -07:00
parent b4a68d1a37
commit ace5f15a36
2 changed files with 4 additions and 4 deletions

View File

@ -78,7 +78,7 @@ Device.prototype.toJSON = function() {
name: this.name,
driver: this.driver.constructor.name || this.driver.name,
pin: this.pin,
connection: this.connection.toJSON(),
connection: this.connection.name,
commands: this.driver.commands
};
};

View File

@ -41,7 +41,7 @@ describe("Device", function() {
expect(device.pin).to.be.eql(13);
});
it("sets @connection to the specified connection on the Robot", function() {
it("sets @connection to the name of the specified connection on the Robot", function() {
expect(device.connection).to.be.eql(connection);
});
@ -125,8 +125,8 @@ describe("Device", function() {
expect(json.driver).to.be.eql('Ping');
});
it("contains the device's connection json", function() {
expect(json.connection).to.be.eql(device.connection.toJSON());
it("contains the device's connection name", function() {
expect(json.connection).to.be.eql('loopback');
});
it("contains the device's driver commands", function() {