I have some code that basically displays the last variable x (the variable, but let here x is 20 here) made in this table. In one of the unit tests for him, I have this snippet:
EditedItem.push_to_queue(hiddennow)
20.times{ EditedItem.push_to_queue(random_item) }
Queue.get_entries.each{|entry| assert_not_equal too_far_down, entry}
May or may not be beautiful, but he receives the intention. The hiddennow object has been removed too far in the queue and should no longer return when calling get_entries.
SearchObject.find(:all, :order => "id desc")
SearchObject.find(:all, :order => "created_at desc")
This is a little simplified, but it looks like the 20.times loop adds things fast enough so that the order by created_at order does not differ. My questions: am I doing something fundamentally wrong? If not, what is the best approach to writing a test on these lines?