[rspec-users] Someone please name this matcher for me

Cohen, Joseph JDCOHEN at stoel.com
Wed Aug 6 14:25:48 EDT 2008


 
Consider:
should_have_the_same_members_as

-----Original Message-----
From: rspec-users-bounces at rubyforge.org
[mailto:rspec-users-bounces at rubyforge.org] On Behalf Of Zach Dennis
Sent: Wednesday, August 06, 2008 11:15 AM
To: rspec-users
Subject: Re: [rspec-users] Someone please name this matcher for me

On Wed, Aug 6, 2008 at 1:50 PM, Pat Maddox <pergesu at gmail.com> wrote:
> I've had a matcher in my head for a couple months, that I frequently
> want but never get around to writing because I can't think of the name
> for it.  Here's how it would look
>
> [1, 2, 3, 4, 1].should ... [1, 3, 1, 4, 2]
>
> I have a couple ideas for names, but I'll hold off on them so I don't
> influence anyone's opinion.
>
> btw, I realize that .sort works in this case.  But that's slightly
> less clear than I'd like, and it doesn't work for non-Comparable
> objects (like activerecords).

  [1, 2, 3, 4, 1].should consist_of([1, 3, 1, 4, 2])

Since consist means "to be composed or made up of", which matches the
usage.

To me it reads like, this thing should be made up of these other things.

WDYT?

-- 
Zach Dennis
http://www.continuousthinking.com
http://www.mutuallyhuman.com
_______________________________________________
rspec-users mailing list
rspec-users at rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


More information about the rspec-users mailing list