Commit 44a82ec3d7bd197113520f9b81993c9f700c44c8

Authored by AntonioTerceiro
1 parent dfe481cc

ActionItem154: minor refactoring


git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1398 3f533792-8f58-4932-b0fe-aaf55b0a4547
app/models/members_block.rb
@@ -37,10 +37,6 @@ class MembersBlock < ProfileListBlock @@ -37,10 +37,6 @@ class MembersBlock < ProfileListBlock
37 result 37 result
38 end 38 end
39 39
40 - def pick_random(top)  
41 - rand(top)  
42 - end  
43 -  
44 end 40 end
45 41
46 42
app/models/profile_list_block.rb
@@ -31,6 +31,9 @@ class ProfileListBlock < Block @@ -31,6 +31,9 @@ class ProfileListBlock < Block
31 def find 31 def find
32 Profile.find(:all, :limit => block.limit, :order => 'created_at desc') 32 Profile.find(:all, :limit => block.limit, :order => 'created_at desc')
33 end 33 end
  34 + def pick_random(top)
  35 + rand(top)
  36 + end
34 end 37 end
35 38
36 def profiles 39 def profiles
test/unit/profile_list_block_test.rb
@@ -25,7 +25,6 @@ class ProfileListBlockTest < Test::Unit::TestCase @@ -25,7 +25,6 @@ class ProfileListBlockTest < Test::Unit::TestCase
25 owner.boxes.first.blocks << block 25 owner.boxes.first.blocks << block
26 block.save! 26 block.save!
27 27
28 - # faking that we are picking random people  
29 profiles = [person1, person3] 28 profiles = [person1, person3]
30 block.expects(:profiles).returns(profiles) 29 block.expects(:profiles).returns(profiles)
31 30