Commit 44a82ec3d7bd197113520f9b81993c9f700c44c8
1 parent
dfe481cc
Exists in
master
and in
23 other branches
ActionItem154: minor refactoring
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1398 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
3 changed files
with
3 additions
and
5 deletions
Show diff stats
app/models/members_block.rb
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 |