diff --git a/lib/nconf/provider.js b/lib/nconf/provider.js index 5e39e382..4e9c297b 100644 --- a/lib/nconf/provider.js +++ b/lib/nconf/provider.js @@ -148,7 +148,7 @@ Provider.prototype.add = function (name, options, usage) { // this was used in the call to `.add()`. // Provider.prototype.remove = function (name) { - delete this.stores[name]; + this.stores[name] = null; return this; }; diff --git a/test/provider-test.js b/test/provider-test.js index ac4c5fdc..d26703ce 100644 --- a/test/provider-test.js +++ b/test/provider-test.js @@ -71,7 +71,15 @@ vows.describe('nconf/provider').addBatch({ "when 'env' is set to true with a nested separator": helpers.assertSystemConf({ script: path.join(fixturesDir, 'scripts', 'nconf-nested-env.js'), env: { SOME_THING: 'foobar' } - }) + }), + "calling the use() method after adding other stores": { + topic: new nconf.Provider().use('file', { file: files[0] }).defaults({candy: {something: 'should never get this'}}), + "should use a new instance of the store type": function (provider) { + provider.use('file', { file: files[1] }); + + assert.equal(provider.get('candy:something'), 'file2'); + } + }, } } }).addBatch({