🕷 software projects

by ryan davis



A minitest assertion for unordered collection equality.

Adds a new assertion to minitest for checking the contents of a collection, ignoring element order.

  • The actual and expected collections must be Enumerable.
  • 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.

Get The Code

If you just want to use minitest-unordered, you can install it via RubyGems:
gem install minitest-unordered
Fork me on GitHub If you want to hack on minitest-unordered, clone it from GitHub:
git clone git://github.com/seattlerb/minitest-unordered

Latest Activity