I often want to compare arrays and make sure that they contain the same elements, in any order. IS there a consise way to do this in RSpec?
Here are methods that aren't acceptable:
#to_set
For example:
array.to_set.should == another_array.to_set
This fails when the arrays contain duplicate items.
#sort
For example:
array.sort.should == another_array.sort
This fails when the arrays elements don't implement #<=>
#size
and #to_set
For example:
array.to_set.should == another_array.to_set
array.size.should == another_array.size
This would work, but there's got to be a better way.