Commit f2e976883615dddbde74e493c400eb17a8f79e34

Authored by Rodrigo Souto
1 parent 66c0650c

Avoid randomness on tests

test/unit/profile_test.rb
@@ -363,7 +363,7 @@ class ProfileTest < ActiveSupport::TestCase @@ -363,7 +363,7 @@ class ProfileTest < ActiveSupport::TestCase
363 t2 = c.tasks.build; t2.save!; t2.finish 363 t2 = c.tasks.build; t2.save!; t2.finish
364 t3 = c.tasks.build; t3.save!; t3.finish 364 t3 = c.tasks.build; t3.save!; t3.finish
365 365
366 - assert_equal [t2, t3], c.tasks.finished 366 + assert_equivalent [t2, t3], c.tasks.finished
367 end 367 end
368 368
369 should 'responds to categories' do 369 should 'responds to categories' do
test/unit/uploaded_file_test.rb
@@ -324,13 +324,11 @@ class UploadedFileTest < ActiveSupport::TestCase @@ -324,13 +324,11 @@ class UploadedFileTest < ActiveSupport::TestCase
324 should 'group trackers activity of image\'s upload' do 324 should 'group trackers activity of image\'s upload' do
325 ActionTracker::Record.delete_all 325 ActionTracker::Record.delete_all
326 gallery = fast_create(Gallery, :profile_id => profile.id) 326 gallery = fast_create(Gallery, :profile_id => profile.id)
327 - count = ActionTracker::Record.find_all_by_verb('upload_image').count  
328 image1 = UploadedFile.create!(:uploaded_data => fixture_file_upload('/files/rails.png', 'image/png'), :parent => gallery, :profile => profile) 327 image1 = UploadedFile.create!(:uploaded_data => fixture_file_upload('/files/rails.png', 'image/png'), :parent => gallery, :profile => profile)
329 - count += 1  
330 - assert_equal count, ActionTracker::Record.find_all_by_verb('upload_image').count 328 + assert_equal 1, ActionTracker::Record.find_all_by_verb('upload_image').count
331 329
332 image2 = UploadedFile.create!(:uploaded_data => fixture_file_upload('/files/other-pic.jpg', 'image/jpg'), :parent => gallery, :profile => profile) 330 image2 = UploadedFile.create!(:uploaded_data => fixture_file_upload('/files/other-pic.jpg', 'image/jpg'), :parent => gallery, :profile => profile)
333 - assert_equal count, ActionTracker::Record.find_all_by_verb('upload_image').count 331 + assert_equal 1, ActionTracker::Record.find_all_by_verb('upload_image').count
334 end 332 end
335 333
336 { 334 {