From ace5f15a3681cf96d8406b7c7bebfd84bb22b097 Mon Sep 17 00:00:00 2001 From: Andrew Stewart Date: Tue, 15 Jul 2014 11:49:29 -0700 Subject: [PATCH] Refer to device connections by name in JSON format --- lib/device.js | 2 +- test/specs/device.spec.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/device.js b/lib/device.js index ba1472a..b25ab64 100644 --- a/lib/device.js +++ b/lib/device.js @@ -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 }; }; diff --git a/test/specs/device.spec.js b/test/specs/device.spec.js index 38dea10..d042346 100644 --- a/test/specs/device.spec.js +++ b/test/specs/device.spec.js @@ -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() {