diff --git a/lib/test/loopback.js b/lib/test/loopback.js index 3be33de..2f969e5 100644 --- a/lib/test/loopback.js +++ b/lib/test/loopback.js @@ -8,30 +8,18 @@ "use strict"; -var namespace = require('node-namespace'); - var Adaptor = require('../adaptor'); -module.exports = { - adaptor: function(opts) { - return new Cylon.Adaptors.Loopback(opts); - } +var Loopback; + +module.exports = Loopback = function Loopback() { + Loopback.__super__.constructor.apply(this, arguments); }; -namespace("Cylon.Adaptors", function() { - this.Loopback = (function(klass) { - subclass(Loopback, klass); +subclass(Loopback, Adaptor); - function Loopback() { - var _ref = Loopback.__super__.constructor.apply(this, arguments); - return _ref; - } +Loopback.prototype.commands = function() { + return ['ping']; +}; - Loopback.prototype.commands = function() { - return ['ping']; - }; - - return Loopback; - - })(Adaptor); -}); +Loopback.adaptor = function(opts) { return new Loopback(opts); }; diff --git a/lib/test/ping.js b/lib/test/ping.js index 67939b3..5b43021 100644 --- a/lib/test/ping.js +++ b/lib/test/ping.js @@ -8,34 +8,22 @@ 'use strict'; -var namespace = require('node-namespace'); - var Driver = require('../driver'); -module.exports = { - driver: function(opts) { - return new Cylon.Drivers.Ping(opts); - } +var Ping; + +module.exports = Ping = function Ping() { + Ping.__super__.constructor.apply(this, arguments); }; -namespace("Cylon.Drivers", function() { - this.Ping = (function(klass) { - subclass(Ping, klass); +subclass(Ping, Driver); - function Ping() { - var _ref = Ping.__super__.constructor.apply(this, arguments); - return _ref; - } +Ping.prototype.commands = function() { + return ['ping']; +}; - Ping.prototype.commands = function() { - return ['ping']; - }; +Ping.prototype.ping = function() { + return "pong"; +}; - Ping.prototype.ping = function() { - return "pong"; - }; - - return Ping; - - })(Driver); -}); +Ping.driver = function(opts) { return new Ping(opts); }; diff --git a/lib/test/test-adaptor.js b/lib/test/test-adaptor.js index dd573a7..79b71a1 100644 --- a/lib/test/test-adaptor.js +++ b/lib/test/test-adaptor.js @@ -8,28 +8,14 @@ "use strict"; -var namespace = require('node-namespace'); - var Adaptor = require('../adaptor') -module.exports = { - adaptor: function(opts) { - return new Cylon.Adaptors.TestAdaptor(opts); - } +var TestAdaptor; + +module.exports = TestAdaptor = function TestAdaptor() { + TestAdaptor.__super__.constructor.apply(this, arguments); }; -namespace("Cylon.Adaptors", function() { - this.TestAdaptor = (function(klass) { - subclass(TestAdaptor, klass); +subclass(TestAdaptor, Adaptor); - function TestAdaptor(opts) { - if (opts == null) { - opts = {}; - } - TestAdaptor.__super__.constructor.apply(this, arguments); - } - - return TestAdaptor; - - })(Adaptor); -}); +TestAdaptor.adaptor = function(opts) { return new TestAdaptor(opts); }; diff --git a/lib/test/test-driver.js b/lib/test/test-driver.js index 21d8108..f1bb139 100644 --- a/lib/test/test-driver.js +++ b/lib/test/test-driver.js @@ -8,28 +8,14 @@ 'use strict'; -var namespace = require('node-namespace'); - var Driver = require('../driver'); -module.exports = { - driver: function(opts) { - return new Cylon.Drivers.TestDriver(opts); - } +var TestDriver; + +module.exports = TestDriver = function TestDriver() { + TestDriver.__super__.constructor.apply(this, arguments); }; -namespace("Cylon.Drivers", function() { - this.TestDriver = (function(klass) { - subclass(TestDriver, klass); +subclass(TestDriver, Driver); - function TestDriver(opts) { - if (opts == null) { - opts = {}; - } - TestDriver.__super__.constructor.apply(this, arguments); - } - - return TestDriver; - - })(Driver); -}); +TestDriver.driver = function(opts) { return new TestDriver(opts); }; diff --git a/test/specs/device.spec.js b/test/specs/device.spec.js index 7c48c0a..157f79b 100644 --- a/test/specs/device.spec.js +++ b/test/specs/device.spec.js @@ -1,5 +1,7 @@ "use strict"; +var Ping = source('test/ping'); + source("device"); source("robot"); @@ -11,7 +13,7 @@ describe("Cylon.Device", function() { var connection = robot.connections.loopback; - var driver = new Cylon.Drivers.Ping({ + var driver = new Ping({ name: 'driver', device: { connection: connection, port: 13 } })