Rails /w Ruby 1.9.1p243 - Unit Test assert_equal question

Hi everyone

I am new to Rails. My platform is Ubuntu 9.04 with Ruby 1.9.1p243 and Rails 2.3.4. I am reading SitePoint's Simply Rails 2 book. On page 240, the author shows how to test the associations between Story and Vote model.

The code is below


because arrays are fundamentally ordered collections so for an array == means same elements and in the same order. Whenever you get something out of the database and there is no order clause (eg if you do Vote.all, or the association you have here) the database is free to return stuff in any order it wants to. Quite often it will be mostly the same order each time but you shouldn't rely on that (more often than not it will something to do with the order things are stored in on disk.