RS, IZ; wrote and tested user retractions actually removing people from the friend lists on retractions

This commit is contained in:
ilya 2010-08-13 11:19:20 -07:00
parent 1fcb033b68
commit 7bd1193c5e
2 changed files with 20 additions and 4 deletions

View file

@ -150,7 +150,7 @@ class User
Rails.logger.debug("Receiving object:\n#{object.inspect}")
if object.is_a? Retraction
object.perform self.id
(object.type == 'Person' )? (unfriended_by object.post_id) : (object.perform self.id)
elsif object.is_a? Request
person = Diaspora::Parser.get_or_create_person_object_from_xml( xml )
person.serialized_key ||= object.exported_key

View file

@ -130,12 +130,28 @@ describe Diaspora::Parser do
it 'should process retraction for a person' do
person_count = Person.all.count
retraction = Retraction.for(@user)
request = retraction.to_diaspora_xml
request = @user.send_friend_request_to( @user2.receive_url, @group.id)
request.reverse @user2
xml = request.to_diaspora_xml
retraction = Retraction.for(@user2)
retraction_xml = retraction.to_diaspora_xml
@user2.person.destroy
@user2.destroy
@user.receive xml
@group.reload
group_people_count = @group.people.size
#They are now friends
Person.count.should == person_count
@user.receive request
@user.receive retraction_xml
Person.count.should == person_count-1
@group.reload
@group.people.size.should == group_people_count -1
end
it 'should marshal a profile for a person' do