Fix (Inflector::Methods#underscore): small regression #43552
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
After this pull request was merged : dd5b00c, a tiny regression appeared on
ActiveSupport::Inflector.underscore
for some casesBefore when we were using the method
underscore
onAccountsv2N2Test
it was returning this :accountsv2_n2_test
but after the modifications, it was only returning this :accountsv2n2_test
To fix this we modified the regex from
/([A-Z\d]+)(?=[A-Z][a-z])|([a-z\d])(?=[A-Z])/
to/([A-Z]+)(?=[A-Z][a-z])|([a-z\d])(?=[A-Z])/
and we added a little test case to it.Please feel free to ask me any question about it.
Best regards,
Thornolf