I have this hash:
{
a: [
{ b: 'c' },
{ d: 'e' }
],
b: [
{ f: 'f' },
{ g: 'g' }
]
}
How can I test it that it's contents are equal to another to another hash without considering the order of the keys? For example:
{
b: [
{ g: 'g' },
{ f: 'f' }
]
a: [
{ d: 'e' },
{ b: 'c' }
]
}
As you can see both are hashes identical for my purposes, except for the order of keys in the shallow and nested positions.
I tried this, but it fails because it takes into account the key order:
test 'hashes have same content' do
assert_equal expected_hash, result_hash
end