On Feb 22, 8:02 pm, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> On Feb 22, 2:08 am, "Mislav Marohnić" <[EMAIL PROTECTED]>
> wrote:
>
> > Hashes should not be compared by their
> > string representations.
>
> No. But you can do this: assert_equal hash1.sort, hash2.sort
> As long as the keys have <=> method defined, it'll work.
Hi Alex,
The test (and method) in question is about checking an error message
which happens to contain a stringrep of a hash, so while what you're
suggesting is (of course) possible, it's not immediately useful
here :-)
Effectively the test passes a hash into a method and checks that it
gets a message something like "there was a problem with the hash
{:key1 => value1, :key2 => :value2}". The way to fix it properly, I
suspect, is for the method to sort the hash as it builds the string,
so that the assert can just compare strings knowing that the hash will
always be in a certain order in that string.
Since I'm not terribly familiar with the codebase, and I was In
"broken build! patch it quick!" mode, my quick'n'dirty patch just
fixed the symptom, not the cause...all of which is teahcing me that
broken build isn't such a big emergency :-)
Alan
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Core" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---