From 8adacef282a743c9b6219f7bfeced15a8468fde6 Mon Sep 17 00:00:00 2001 From: Andrew Stewart Date: Tue, 9 Jun 2015 07:21:03 -0700 Subject: [PATCH] s/source/lib for loading files for specs --- spec/.eslintrc | 2 +- spec/helper.js | 4 ++-- spec/lib/adaptor.spec.js | 4 ++-- spec/lib/basestar.spec.js | 4 ++-- spec/lib/cylon.spec.js | 12 ++++++------ spec/lib/digital-pin.spec.js | 4 ++-- spec/lib/driver.spec.js | 4 ++-- spec/lib/io/utils.js | 2 +- spec/lib/logger.spec.js | 4 ++-- spec/lib/logger/basic_logger.spec.js | 2 +- spec/lib/registry.spec.js | 2 +- spec/lib/robot.spec.js | 8 ++++---- spec/lib/utils.spec.js | 2 +- spec/lib/utils/helpers.spec.js | 2 +- 14 files changed, 28 insertions(+), 28 deletions(-) diff --git a/spec/.eslintrc b/spec/.eslintrc index 3faa542..743512f 100644 --- a/spec/.eslintrc +++ b/spec/.eslintrc @@ -3,7 +3,7 @@ env: globals: expect: true - source: true + lib: true stub: true spy: true chai: true diff --git a/spec/helper.js b/spec/helper.js index 35d68e4..b4e0389 100644 --- a/spec/helper.js +++ b/spec/helper.js @@ -22,11 +22,11 @@ global.spy = sinon.spy; global.stub = sinon.stub; // convenience function to require modules in lib directory -global.source = function(module) { +global.lib = function(module) { return require(path.normalize("./../lib/" + module)); }; -var Cylon = source("cylon"); +var Cylon = lib("cylon"); Cylon.config({ mode: "manual", diff --git a/spec/lib/adaptor.spec.js b/spec/lib/adaptor.spec.js index c19342c..9c0e5db 100644 --- a/spec/lib/adaptor.spec.js +++ b/spec/lib/adaptor.spec.js @@ -1,7 +1,7 @@ "use strict"; -var Adaptor = source("adaptor"), - Utils = source("utils"); +var Adaptor = lib("adaptor"), + Utils = lib("utils"); describe("Adaptor", function() { var adaptor; diff --git a/spec/lib/basestar.spec.js b/spec/lib/basestar.spec.js index 4280543..616aab3 100644 --- a/spec/lib/basestar.spec.js +++ b/spec/lib/basestar.spec.js @@ -1,7 +1,7 @@ "use strict"; -var Basestar = source("basestar"), - Utils = source("utils"); +var Basestar = lib("basestar"), + Utils = lib("utils"); var EventEmitter = require("events").EventEmitter; diff --git a/spec/lib/cylon.spec.js b/spec/lib/cylon.spec.js index 75fdd04..78ee96e 100644 --- a/spec/lib/cylon.spec.js +++ b/spec/lib/cylon.spec.js @@ -1,12 +1,12 @@ "use strict"; -var Cylon = source("cylon"), - Robot = source("robot"); +var Cylon = lib("cylon"), + Robot = lib("robot"); -var Logger = source("logger"), - Adaptor = source("adaptor"), - Driver = source("driver"), - Config = source("config"); +var Logger = lib("logger"), + Adaptor = lib("adaptor"), + Driver = lib("driver"), + Config = lib("config"); describe("Cylon", function() { describe("exports", function() { diff --git a/spec/lib/digital-pin.spec.js b/spec/lib/digital-pin.spec.js index 1e70d40..94398dd 100644 --- a/spec/lib/digital-pin.spec.js +++ b/spec/lib/digital-pin.spec.js @@ -3,8 +3,8 @@ var fs = require("fs"); -var DigitalPin = source("io/digital-pin"), - Utils = source("utils"); +var DigitalPin = lib("io/digital-pin"), + Utils = lib("utils"); describe("Cylon.IO.DigitalPin", function() { var pin = new DigitalPin({ pin: "4", mode: "w" }); diff --git a/spec/lib/driver.spec.js b/spec/lib/driver.spec.js index 0fa81cf..0d460a5 100644 --- a/spec/lib/driver.spec.js +++ b/spec/lib/driver.spec.js @@ -1,7 +1,7 @@ "use strict"; -var Driver = source("driver"), - Utils = source("utils"); +var Driver = lib("driver"), + Utils = lib("utils"); describe("Driver", function() { var connection, driver; diff --git a/spec/lib/io/utils.js b/spec/lib/io/utils.js index 52cd4ae..77942c9 100644 --- a/spec/lib/io/utils.js +++ b/spec/lib/io/utils.js @@ -1,6 +1,6 @@ "use strict"; -var Utils = source("io/utils.js"); +var Utils = lib("io/utils.js"); describe("IOUtils", function() { describe("#periodAndDuty", function() { diff --git a/spec/lib/logger.spec.js b/spec/lib/logger.spec.js index ed8c4ce..e23fc96 100644 --- a/spec/lib/logger.spec.js +++ b/spec/lib/logger.spec.js @@ -1,7 +1,7 @@ "use strict"; -var Logger = source("logger"), - Config = source("config"); +var Logger = lib("logger"), + Config = lib("config"); describe("Logger", function() { afterEach(function() { diff --git a/spec/lib/logger/basic_logger.spec.js b/spec/lib/logger/basic_logger.spec.js index 554d77b..5b73531 100644 --- a/spec/lib/logger/basic_logger.spec.js +++ b/spec/lib/logger/basic_logger.spec.js @@ -1,6 +1,6 @@ "use strict"; -var logger = source("logger/basic_logger"); +var logger = lib("logger/basic_logger"); var date = new Date(0).toISOString(); diff --git a/spec/lib/registry.spec.js b/spec/lib/registry.spec.js index 1d2bd11..dba55ae 100644 --- a/spec/lib/registry.spec.js +++ b/spec/lib/registry.spec.js @@ -1,6 +1,6 @@ "use strict"; -var Registry = source("registry"); +var Registry = lib("registry"); var path = "./../spec/support/mock_module.js"; diff --git a/spec/lib/robot.spec.js b/spec/lib/robot.spec.js index cb5d37e..75ae455 100644 --- a/spec/lib/robot.spec.js +++ b/spec/lib/robot.spec.js @@ -1,9 +1,9 @@ "use strict"; -var Driver = source("driver"), - Adaptor = source("adaptor"), - Robot = source("robot"), - Logger = source("logger"); +var Driver = lib("driver"), + Adaptor = lib("adaptor"), + Robot = lib("robot"), + Logger = lib("logger"); describe("Robot", function() { var work, extraFunction, robot; diff --git a/spec/lib/utils.spec.js b/spec/lib/utils.spec.js index 2668a29..441b7a3 100644 --- a/spec/lib/utils.spec.js +++ b/spec/lib/utils.spec.js @@ -1,6 +1,6 @@ "use strict"; -var utils = source("utils"); +var utils = lib("utils"); describe("Utils", function() { describe("Monkey-patches", function() { diff --git a/spec/lib/utils/helpers.spec.js b/spec/lib/utils/helpers.spec.js index d4925e9..8fe72e9 100644 --- a/spec/lib/utils/helpers.spec.js +++ b/spec/lib/utils/helpers.spec.js @@ -1,6 +1,6 @@ "use strict"; -var _ = source("utils/helpers"); +var _ = lib("utils/helpers"); describe("Helpers", function() { describe("extend", function() {