Colin Law wrote in post #965435: > Hi > I have a named scope that sets a sort order. In my unit test I can > run the query on a set of records (using Factory or fixtures) and > check the sort order is correct. I believe though that a find without > an explicit sort order may return the records in any order, so how can > I be sure that it is not just accidental that they are in the correct > order?
Try creating the factories in a weird order. If they still are returned in the correct order, then your sorting is correct. ...or... Write the test so that it checks that the appropriate :order clause is set. This is probably too invasive and implementation-dependent for my taste, though I might do it occasionally. > > Colin Best, -- Marnen Laibow-Koser http://www.marnen.org [email protected] -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" 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-talk?hl=en.

