Rspec: “array.should == another_array” but without concern for order

前端 未结 6 2045

I often want to compare arrays and make sure that they contain the same elements, in any order. Is there a concise way to do this in RSpec?

Here are methods that are

6条回答
  •  醉酒成梦
    2020-12-12 10:27

    Try array.should =~ another_array

    The best documentation on this I can find is the code itself, which is here.

提交回复
热议问题