Skip to content

Commit

Permalink
Merge pull request #171 from blahah/master
Browse files Browse the repository at this point in the history
Respect falsy overrides (fixes #151)
  • Loading branch information
gangstead committed Feb 7, 2017
2 parents 65ac6e2 + df42a26 commit 1c95d1d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/prompt.js
Expand Up @@ -465,7 +465,7 @@ prompt.getInput = function (prop, callback) {
// Handle overrides here.
// TODO: Make overrides nestable
//
if (prompt.override && prompt.override[propName]) {
if (prompt.override && prompt.override.hasOwnProperty(propName)) {
if (prompt._performValidation(name, prop, prompt.override, schema, -1, callback)) {
return callback(null, prompt.override[propName]);
}
Expand Down
14 changes: 14 additions & 0 deletions test/prompt-test.js
Expand Up @@ -632,6 +632,20 @@ vows.describe('prompt').addBatch({
}
}
}
}).addBatch({
"When using prompt": {
"the get() method": {
"skip prompt with falsy prompt.overide": {
topic: function () {
prompt.override = { coconihet: false }
prompt.get('coconihet', this.callback);
},
"skips prompt and uses overide": function (err, results) {
assert.equal(results.coconihet, false)
}
}
}
}
}).addBatch({
"When using prompt": {
"the addProperties() method": {
Expand Down

0 comments on commit 1c95d1d

Please sign in to comment.