Skip to content

Instantly share code, notes, and snippets.

@nzakas
Created November 13, 2014 23:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nzakas/7d4eaea331ebf90d6647 to your computer and use it in GitHub Desktop.
Save nzakas/7d4eaea331ebf90d6647 to your computer and use it in GitHub Desktop.
Test for YAML config overrides
override: ./tests/fixtures/override.yml
http:
port.prod: 6000
port.dev: 7000
application:
mode.prod: prod
# Default Configuration
box:
apiRoot: /api
clientId: me
clientSecret: 42
authCookieName: z
# Dev Configuration
box.dev:
apiRoot: /dev
clientId: you
clientSecret: blue
http:
port: 9999
# Default Configuration
box:
clientSecret: 44
clientSecret.live: 43
it('should return the correct configuration when reading an object under dev mode with defaults and override', function() {
var data = loader.load('tests/fixtures/application_override.yml', 'dev');
assert.equal(data.box.apiRoot, '/dev');
assert.equal(data.box.clientId, 'you');
assert.equal(data.box.clientSecret, 44);
// special case - exists in default "box" object but not in "box.dev"
assert.equal(data.box.authCookieName, 'z');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment