Created
November 13, 2014 23:23
-
-
Save nzakas/7d4eaea331ebf90d6647 to your computer and use it in GitHub Desktop.
Test for YAML config overrides
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http: | |
port: 9999 | |
# Default Configuration | |
box: | |
clientSecret: 44 | |
clientSecret.live: 43 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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