Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add useDefaults option to mockPrompt #487

Merged
merged 1 commit into from Feb 5, 2014

Conversation

hurrymaplelad
Copy link
Contributor

I wanted to test the default option flow in my generator. mockPrompt didn't make this easy. The useDefaults option makes this easy without breaking backwards compatibilty.

helpers.mockPrompt(generator, { answer: 'foo' }, { useDefaults: true });

See tests for expected results.

@SBoudrias
Copy link
Member

You'll have to fix the Travis error about style guide :)

{ name: 'answser', type: 'input', default: 'bar'},
{ name: 'respuesta', type: 'input', default: 'baz'}
], function (answers) {
assert.equal(answers.answer, 'foo');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You assert too much in a single test.

Take the mockPrompt call in a beforeEach call (add a describe level -> "when useDefaults: true") and assert that defaults are used, and then in another assert that provided values are taken.

@SBoudrias
Copy link
Member

I wonder if we shouldn't just use defaults by default. It'd make sense IMO and wouldn't require an extra option with the related overhead.

@hurrymaplelad
Copy link
Contributor Author

I'd love for this to be the default! Should we keep the option defaulted to true, then pull it out in a few versions to ease migration, or just go for it?

@SBoudrias
Copy link
Member

I'd say just go for it!

@sindresorhus
Copy link
Member

👍 for default

@addyosmani
Copy link
Member

Let's roll with defaults.

@hurrymaplelad
Copy link
Contributor Author

Done, squashed.

@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling 6a235ab on hurrymaplelad:mock_prompt_defaults into 116b321 on yeoman:master.

SBoudrias added a commit that referenced this pull request Feb 5, 2014
@SBoudrias SBoudrias merged commit ea2d818 into yeoman:master Feb 5, 2014
@SBoudrias
Copy link
Member

Perfect! Thanks :shipit:

@hurrymaplelad hurrymaplelad deleted the mock_prompt_defaults branch March 3, 2014 04:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants