> I have created a `shuffle_fixtures` branch and updated `insert_fixtures` 
> method 
> to shuffle fixtures and executed ActiveRecord unit tests with postgresql 
> adapter.
> 
> - `shuffle_fixtures` branch
> https://github.com/yahonda/rails/tree/shuffle_fixtures


Hmmm, interesting.


Introducing deliberate randomness seems like a good idea, to flush out 
accidental ordering assumptions in the tests — particularly our own.

But I’m not sure whether a full shuffle is going to focus on the right set of 
assumptions:

* It changes the order in which IDs are assigned to records, so .order(:id) can 
no longer be trusted as a simple “in fixture order” definition.

* It *doesn’t* change the order rows will be returned relative to their IDs: 
even after this, most of the time User.all.to_a will match User.order(:id).to_a.



I wonder if there’d be any merit to an “order torture” config setting, which 
adds an `ORDER BY random()`-type clause to every relation query…



Matthew

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-core+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-core@googlegroups.com.
Visit this group at https://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.

Reply via email to