This test passes on my system right now. (It might not on your system, but that's not important. Change the assert_equal
so that it does.)
Now uncomment the @other_hash
declaration. It (probably) fails.
That makes the hashing algorithm in Ruby dependent upon the code that runs before it. Which, when you accidentally depend upon the order of keys in a hash, makes for a lot of confusion later on when it no longer works!
The particular example involved verifying that a model accepted nested attributes. We were doing something along the lines of: