You can do it without dropping back down to SQL. Just check `order_values` on the ActiveRecord::Relation object returned.
On Tuesday, 14 August 2012 at 2:02 PM, Dmytrii Nagirniak wrote: > Hi all, > > I wonder what approaches you take to spec-ing ordering. > Often the ordering doesn't matter much and I tend to skip that part. > > But when it is a feature and doesn't map directly to SQLs "ORDER BY" clause > then it must be spec-ed. > This is especially the case when a mix of DB sorting + memory sorting should > be applied. > > What I tried: > > 1. Assert on the SQL generated. This obviously doesn't actually test much. > 2. Create the test data and assert the order. This is just too fragile since > at times it is hard to fail such spec before doing anything. > 3. Can't see how to apply stubs/mocks etc here, so didn't even try. > > What are the approaches that some of you use for that? > > Cheers, > Dmytrii. > > -- > You received this message because you are subscribed to the Google Groups > "Ruby or Rails Oceania" group. > To post to this group, send email to [email protected] > (mailto:[email protected]). > To unsubscribe from this group, send email to > [email protected] > (mailto:[email protected]). > For more options, visit this group at > http://groups.google.com/group/rails-oceania?hl=en. -- You received this message because you are subscribed to the Google Groups "Ruby or Rails Oceania" 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/rails-oceania?hl=en.
