Skip to content

Allow `pluralize` to handle words that end with s.

Created by: joshuapinter

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".

Merge request reports