[rspec-devel] HaveMatcher & singular collection names

Josh Knowles joshknowles at gmail.com
Tue Dec 18 18:27:10 EST 2007

I often find myself wanting to type out the singular form of the
collection name when using the HaveMatcher with n == 1.  For example:

@person.should have(1).job as opposed to @person.should have(1).jobs

I put together the following patch which attempts to solve this and am
looking for some feedback:


My pluralize method is very weak (it just adds an 's') as I wanted to
get it out there and see if it was useful to anyone else.  If so we
can talk about building out a more robust pluralization system or
piggybacking off of Rails if Inflector is present.

Josh Knowles
phone: 509-979-1593
email:  joshknowles at gmail.com
web:    http://joshknowles.com

More information about the rspec-devel mailing list