Correct tests for auto-start, allow for non-truthy values

This commit is contained in:
Andrew Stewart 2014-09-08 14:12:14 -07:00
parent 12ae17eeb2
commit f0d0e4b738
3 changed files with 25 additions and 3 deletions

View File

@ -120,10 +120,9 @@ var Robot = module.exports = function Robot(opts) {
this.commands = opts.commands;
}
var auto_start = Utils.fetch(Config, 'auto_start', true);
var auto_start = Config.auto_start || true;
if (auto_start) {
if (auto_start) {
this.start();
}
};

View File

@ -96,6 +96,24 @@ describe("Cylon", function() {
});
describe("#setConfig", function() {
var originalConfig = {};
before(function() {
for (var c in Config) {
originalConfig[c] = Config[c];
}
});
after(function() {
for (var c in Config) {
delete Config[c];
}
for (var c in originalConfig) {
Config[c] = originalConfig[c];
}
});
beforeEach(function() {
for (var c in Config) {
delete Config[c];

View File

@ -27,4 +27,9 @@ global.source = function(module) {
};
var Cylon = source('cylon');
Cylon.setConfig({
auto_start: false
});
Cylon.Logger.setup(false);