[Git][noosfero/noosfero][master] Plugin-PeopleBlock: load suggestions with suggested_profiles named scope

Leandro Nunes gitlab at gitlab.com
Mon Jul 13 23:08:09 BRT 2015


Leandro Nunes pushed to branch master at Noosfero / noosfero


Commits:
6fb823a9 by Leandro Nunes dos Santos at 2015-07-13T23:07:36Z
Plugin-PeopleBlock: load suggestions with suggested_profiles named scope

- - - - -


3 changed files:

- plugins/people_block/lib/friends_block.rb
- plugins/people_block/test/functional/profile_controller_test.rb
- plugins/people_block/test/unit/friends_block_test.rb


Changes:

=====================================
plugins/people_block/lib/friends_block.rb
=====================================
--- a/plugins/people_block/lib/friends_block.rb
+++ b/plugins/people_block/lib/friends_block.rb
@@ -17,7 +17,7 @@ class FriendsBlock < PeopleBlockBase
   end
 
   def suggestions
-    owner.profile_suggestions.of_person.enabled.limit(3).includes(:suggestion)
+    owner.suggested_profiles.of_person.enabled.limit(3).includes(:suggestion)
   end
 
   def footer


=====================================
plugins/people_block/test/functional/profile_controller_test.rb
=====================================
--- a/plugins/people_block/test/functional/profile_controller_test.rb
+++ b/plugins/people_block/test/functional/profile_controller_test.rb
@@ -17,8 +17,8 @@ class ProfileControllerTest < ActionController::TestCase
     login_as(user.login)
     owner = user.person
 
-    suggestion1 = owner.profile_suggestions.create(:suggestion => fast_create(Person))
-    suggestion2 = owner.profile_suggestions.create(:suggestion => fast_create(Person))
+    suggestion1 = ProfileSuggestion.create!(:suggestion => fast_create(Person), :person => owner)
+    suggestion2 = ProfileSuggestion.create!(:suggestion => fast_create(Person), :person => owner)
 
     FriendsBlock.delete_all
     block = FriendsBlock.new


=====================================
plugins/people_block/test/unit/friends_block_test.rb
=====================================
--- a/plugins/people_block/test/unit/friends_block_test.rb
+++ b/plugins/people_block/test/unit/friends_block_test.rb
@@ -138,8 +138,8 @@ class FriendsBlockTest < ActionView::TestCase
 
   should 'list owner\'s friends suggestions' do
     owner = fast_create(Person)
-    suggestion1 = owner.profile_suggestions.create(:suggestion => fast_create(Person))
-    suggestion2 = owner.profile_suggestions.create(:suggestion => fast_create(Person))
+    suggestion1 = ProfileSuggestion.create!(:suggestion => fast_create(Person), :person => owner)
+    suggestion2 = ProfileSuggestion.create!(:suggestion => fast_create(Person), :person => owner)
 
     block = FriendsBlock.new
     block.stubs(:owner).returns(owner)



View it on GitLab: https://gitlab.com/noosfero/noosfero/commit/6fb823a93b9dc95f54f16e7f4c094ef70a8f5537
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20150714/c8fe169b/attachment.html>


More information about the Noosfero-dev mailing list