I'm trying to test ordering collection by created_at. As it's timestamp with precision to the second, when I create 10 records they have the same created_at value which leads me to inconsistent response. So what I'm doing here is I set created_at field manually like
5.times do |t|
create(:model, created_at: Time.current.advance(days: -1*(t+1))
end
and it set created_at just fine but when I do
Model.all.order(created_at: :desc) it just ignores it and put in ASC order.
Is there any way to test this order as well?
Thanks