[rspec-users] array order-agnostic matching?
james at rapleaf.com
Tue Feb 1 04:40:52 EST 2011
hey, thanks for reading:
I have a problem which can be reduced to this,
from within an example of mine I call the helper 'expect_call' which is
and in one of my examples the 'expected' hash is strictly defined as follows
:some_key => [1,2,3]
however my spec fails because it is actually called with
:some_key => [1,3,2]
:some_key => [2,3,1]
:some_key => [2,1,3]
*i.e. the array part is not in the order i 'expect' BUT i don't actually
care about the order. So I would like to be able to change my one example to
something like this:
*:some_key => [1,2,3]*.ignoring_order
does such a concept exist or do I have to change the implementation of
expect_call to use some sort of custom matcher - I am reluctant to do this
since this method is called in other cases where maybe (for arguments sake)
I DO care about array ordering within the hash.
Hope someone can solve this for me - MUCH appreciation.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the rspec-users