From: Charles Oliver Nutter Date: 2008-10-04T01:06:09+09:00 Subject: Re: Ordered hash hack for < ruby 1.9? Ben Johnson wrote: > I am having an issue testing my code because hashes don't have a > consistent order when you iterate over them. For example, one of the > methods that I am trying to test iterates over a hash and creates a > string. That string is in a different order every time, and my tests > keep failing. > > What would be perfect is if I could modify how the Hash class works so > it preserves the insert order, but only when I am testing. So I could > include this file in my tests. > > Is there anything out there that does this? Thanks for your help. FWIW, JRuby is 1.8.6ish and has insertion-ordered hashes like 1.9. - Charlie