diff --git a/lib/util/storage.js b/lib/util/storage.js index 3b882084..564649cc 100644 --- a/lib/util/storage.js +++ b/lib/util/storage.js @@ -10,9 +10,8 @@ var _ = require('lodash'); * * @constructor * @param {String} name The name of the new storage (this is a namespace) - * @param {mem-fs-editor} fs A mem-fs editor instance - * @param {String} configPath The filepath used as a storage. `.yo-rc.json` is used - * by default + * @param {mem-fs-editor} fs A mem-fs editor instance + * @param {String} configPath The filepath used as a storage. * * @example * var MyGenerator = yeoman.generators.base.extend({ @@ -24,8 +23,9 @@ var _ = require('lodash'); var Storage = module.exports = function Storage(name, fs, configPath) { assert(name, 'A name parameter is required to create a storage'); + assert(configPath, 'A config filepath is required to create a storage'); - this.path = configPath || path.join(process.cwd(), '.yo-rc.json'); + this.path = configPath; this.name = name; this.fs = fs; diff --git a/test/storage.js b/test/storage.js index ed98aa52..7798ee48 100644 --- a/test/storage.js +++ b/test/storage.js @@ -54,13 +54,10 @@ describe('Storage', function () { assert.equal(this.store.get('foo'), 'bar'); }); - it('defaults store path to `.yo-rc.json`', function () { - process.chdir(tmpdir); - var store = new Storage('yo', this.fs); - store.set('foo', 'bar'); - - var fileContent = this.fs.readJSON('.yo-rc.json'); - assert.equal(fileContent.yo.foo, 'bar'); + it('a config path is required', function () { + assert.throws(function () { + new Storage('yo', this.fs); + }); }); describe('#get()', function () {