This repository was archived by the owner on Nov 30, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 753
Allow pluralize
to handle words that end with s.
#2779
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
JonRowe
suggested changes
Nov 16, 2020
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, could you just sort out the white spacing, I don't really want this to become a full on complex pluraliser, it was just supposed to be a basic one, but I think this is common enough that I don't mind adding this one case.
100%. Just enough to catch most of the common cases. |
Use Case: We have a custom formatter that we use with `parallel_tests` to get a cleaner output from the various test processes. We make use of `RSpec::Core::Formatters::Helpers.pluralize` in there to display the number of remaining processes left. However, instead of getting "processes", we get "processs". Looking into the `pluralize` method definition, it simple adds an "s" to the end of the provided String, unless the count is equal to 1. Without accounting for all the different words that are possible, which something like Rails would do, we just extended this to add "es" if the provided String ends in "s" already. We also added tests for words that end in "s" and words that do not end in "s".
JonRowe
approved these changes
Nov 16, 2020
👍 |
yujinakayama
pushed a commit
to yujinakayama/rspec-monorepo
that referenced
this pull request
Oct 6, 2021
…_words_ending_in_s Allow `pluralize` to handle words that end with s. --- This commit was imported from rspec/rspec-core@2bda6b7.
yujinakayama
pushed a commit
to yujinakayama/rspec-monorepo
that referenced
this pull request
Oct 6, 2021
This commit was imported from rspec/rspec-core@32d2150.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Use Case:
We have a custom formatter that we use with
parallel_tests
to get a cleaner output from the various test processes.We make use of
RSpec::Core::Formatters::Helpers.pluralize
in there to display the number of remaining processes left.However, instead of getting "processes", we get "processs".
Looking into the
pluralize
method definition, it simple adds an "s" to the end of the provided String, unless the count is equal to 1.Without accounting for all the different words that are possible, which something like Rails would do, we just extended this to add "es" if the provided String ends in "s" already.
We also added tests for words that end in "s" and words that do not end in "s".