Use single quotes in generated template steps #1323
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Update the missing step generation template to use single-quotes for strings instead of double-quotes.
Details
When pending steps are generated for undefined steps, the step name does
not include any interpolation so double-quotes are not necessary. Only
the single-quotes are necessary for those strings.
This will make the generated steps allow consistent with the ruby style guide:
https://github.com/rubocop-hq/ruby-style-guide#strings
And with the default settings for Rubocop Style/StringLiterals cop:
https://github.com/rubocop-hq/rubocop/blob/ab6346ed37d88a4b900c96979f8ef18959e8dcce/lib/rubocop/cop/style/string_literals.rb
Motivation and Context
This will make it easier to use the generated steps, in a project using Rubocop, by making those steps already back the default Rubocop rules.
How Has This Been Tested?
I have updated the existing cucumber and rspec tests for the step generation.
Types of changes
Checklist:
Thank you to everyone who works on cucumber. I use in in my work and personal projects, and I am very grateful that it exists!
This is my first PR to a cucumber repo, so if there is anything that I got wrong, or can do to make it easier to merge, please let me know and I will try to update it quickly.