Skip to content

Instantly share code, notes, and snippets.

@apeiros
Created June 8, 2015 08:57
Show Gist options
  • Save apeiros/278fec21774f6dbe04a3 to your computer and use it in GitHub Desktop.
Save apeiros/278fec21774f6dbe04a3 to your computer and use it in GitHub Desktop.
module Test::Unit::Assertions
def assert_unordered_equal(expected, actual, message=nil)
full_message = build_message(message, "<?> expected but was\n<?>.\n", expected, actual)
assert_block(full_message) {
seen = Hash.new(0)
expected.each { |e| seen[e] += 1 }
actual.each { |e| seen[e] -= 1 }
seen.invert.keys == [0]
}
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment