Given a high enough sample size, and a random insert order, (2) can be used as a test with reasonable confidence.
It's not 100%, but it's close enough and better than the alternatives. On Tue, Aug 14, 2012 at 2:02 PM, Dmytrii Nagirniak <[email protected]> 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]. > 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. > -- Michael Pearson -- 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.
