Commit 6fb823a93b9dc95f54f16e7f4c094ef70a8f5537

Authored by Leandro Santos
1 parent 4fbaaa68

Plugin-PeopleBlock: load suggestions with suggested_profiles named scope

plugins/people_block/lib/friends_block.rb
... ... @@ -17,7 +17,7 @@ class FriendsBlock < PeopleBlockBase
17 17 end
18 18  
19 19 def suggestions
20   - owner.profile_suggestions.of_person.enabled.limit(3).includes(:suggestion)
  20 + owner.suggested_profiles.of_person.enabled.limit(3).includes(:suggestion)
21 21 end
22 22  
23 23 def footer
... ...
plugins/people_block/test/functional/profile_controller_test.rb
... ... @@ -17,8 +17,8 @@ class ProfileControllerTest < ActionController::TestCase
17 17 login_as(user.login)
18 18 owner = user.person
19 19  
20   - suggestion1 = owner.profile_suggestions.create(:suggestion => fast_create(Person))
21   - suggestion2 = owner.profile_suggestions.create(:suggestion => fast_create(Person))
  20 + suggestion1 = ProfileSuggestion.create!(:suggestion => fast_create(Person), :person => owner)
  21 + suggestion2 = ProfileSuggestion.create!(:suggestion => fast_create(Person), :person => owner)
22 22  
23 23 FriendsBlock.delete_all
24 24 block = FriendsBlock.new
... ...
plugins/people_block/test/unit/friends_block_test.rb
... ... @@ -138,8 +138,8 @@ class FriendsBlockTest < ActionView::TestCase
138 138  
139 139 should 'list owner\'s friends suggestions' do
140 140 owner = fast_create(Person)
141   - suggestion1 = owner.profile_suggestions.create(:suggestion => fast_create(Person))
142   - suggestion2 = owner.profile_suggestions.create(:suggestion => fast_create(Person))
  141 + suggestion1 = ProfileSuggestion.create!(:suggestion => fast_create(Person), :person => owner)
  142 + suggestion2 = ProfileSuggestion.create!(:suggestion => fast_create(Person), :person => owner)
143 143  
144 144 block = FriendsBlock.new
145 145 block.stubs(:owner).returns(owner)
... ...