all files / features/step_definitions/ configue-steps.js

100% Statements 23/23
100% Branches 0/0
100% Functions 8/8
100% Lines 23/23
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41                                   
"use strict";
const Code = require('code');
const expect = Code.expect;
 
const ARGV = process.argv;
module.exports = function () {
    this.Given(/^I load Configue(?: with option "(\s+)")?$/, function (option, callback) {
        //TODO: use jsonic
        this.register(this.configue, {}, callback);
    });
 
    this.Given(/^I pass as arguments '([^']+)'$/, function (args, callback) {
        process.argv = ARGV.concat(args);
        callback();
    });
 
    this.Given(/^I pass have as ENV var (\w+) with value (.*)$/, function (name, value, callback) {
        process.env[name] = eval(value);
        callback();
    });
 
    this.When(/^I try to access the "([^"]*)"$/, function (key, callback) {
        this.res = this.server.configue(key);
        callback();
    });
 
    this.Then(/^I should see have for associated value: "([^"]*)"$/, function (expectedRes, callback) {
        expect(expectedRes).to.deep.equal(this.res);
        callback();
    });
 
    this.Then(/^I should see have for associated value: undefined$/, function (callback) {
        expect(this.res).to.not.exist();
        callback();
    });
 
    this.After(function (scenario) {
        process.argv = ARGV;
    });
 
};