Adds a new assertion to minitest for checking the contents of a collection, ignoring element order.
Uses Hash#== for determining collection equivalence; as such, element equality does not behave the same as with +assert_equal+.
assert_equal_unordered %w[a a b c], %w[a b c a] # pass assert_equal_unordered %w[a b b c], %w[a a b c] # fail
[1, 2, 3].must_equal_unordered [3, 1, 2] # pass [1, 2, 3].must_equal_unordered [1, 2, 2] # fail
I don’t actually recommend its use. I don’t think this is a valuable assertion overall.
gem install minitest-unorderedIf you want to hack on minitest-unordered, clone it from GitHub:
git clone git://github.com/seattlerb/minitest-unordered