From 36d1505c2f03e2182d89122fe99b7aef36c0c431 Mon Sep 17 00:00:00 2001 From: Andrew Stewart Date: Mon, 15 Dec 2014 13:17:04 -0800 Subject: [PATCH] Add specs for new #connections/#devices behaviour --- spec/lib/robot.spec.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/spec/lib/robot.spec.js b/spec/lib/robot.spec.js index 0aba7e5..05a09b1 100644 --- a/spec/lib/robot.spec.js +++ b/spec/lib/robot.spec.js @@ -292,6 +292,17 @@ describe("Robot", function() { }); }); + context("when passed an object containing connection details", function() { + it("creates new connections with each of the ones provided", function() { + var connections = { + loopback: { adaptor: "loopback" } + }; + + bot.initConnections({ connections: connections }); + expect(bot.connections.loopback).to.be.instanceOf(Adaptor); + }); + }); + context("when passed an array of connection objects", function() { it("creates new connections with each of the ones provided", function() { var connections = [{ name: "loopback", adaptor: "loopback" }]; @@ -367,6 +378,17 @@ describe("Robot", function() { }); }); + context("when passed an object containing device details", function() { + it("creates new devices with each of the ones provided", function() { + var devices = { + ping: { driver: "ping" } + }; + + bot.initDevices({ devices: devices }); + expect(bot.devices.ping).to.be.instanceOf(Driver); + }); + }); + context("when passed an array of device objects", function() { it("instantiates new drivers with provided objects", function() { var devices = [{ name: "ping", driver: "ping" }];