Add a couple specs to friending
This commit is contained in:
parent
b805155f75
commit
8dd11c0c95
2 changed files with 26 additions and 8 deletions
|
|
@ -86,7 +86,8 @@ module Diaspora
|
|||
|
||||
def remove_friend(bad_friend)
|
||||
raise "Friend not deleted" unless self.friend_ids.delete( bad_friend.id )
|
||||
aspects.each{|g| g.person_ids.delete( bad_friend.id )}
|
||||
aspects.each{|aspect|
|
||||
aspect.person_ids.delete( bad_friend.id )}
|
||||
self.save
|
||||
|
||||
self.raw_visible_posts.find_all_by_person_id( bad_friend.id ).each{|post|
|
||||
|
|
|
|||
|
|
@ -189,16 +189,14 @@ describe User do
|
|||
@user2 = Factory.create :user
|
||||
@aspect2 = @user2.aspect(:name => "Gross people")
|
||||
|
||||
request = @user.send_friend_request_to( @user2, @aspect)
|
||||
request.reverse_for @user2
|
||||
@user2.activate_friend(@user.person, @aspect2)
|
||||
@user.receive request.to_diaspora_xml
|
||||
friend_users(@user, @aspect, @user2, @aspect2)
|
||||
@user.reload
|
||||
@user2.reload
|
||||
@aspect.reload
|
||||
@aspect2.reload
|
||||
end
|
||||
|
||||
it 'should unfriend the other user on the same seed' do
|
||||
@user.reload
|
||||
@user2.reload
|
||||
|
||||
@user.friends.count.should == 1
|
||||
@user2.friends.count.should == 1
|
||||
|
||||
|
|
@ -212,6 +210,25 @@ describe User do
|
|||
@aspect.people.count.should == 0
|
||||
@aspect2.people.count.should == 0
|
||||
end
|
||||
context 'with a post' do
|
||||
before do
|
||||
@message = @user.post(:status_message, :message => "hi", :to => @aspect.id)
|
||||
@user2.receive @message.to_diaspora_xml.to_s
|
||||
@user2.unfriend @user.person
|
||||
@user.unfriended_by @user2.person
|
||||
@aspect.reload
|
||||
@aspect2.reload
|
||||
@user.reload
|
||||
@user2.reload
|
||||
end
|
||||
it "deletes the unfriended user's posts from visible_posts" do
|
||||
@user.raw_visible_posts.include?(@message.id).should be_false
|
||||
end
|
||||
it "deletes the unfriended user's posts from the aspect's posts" do
|
||||
pending "We need to implement this"
|
||||
@aspect2.posts.include?(@message).should be_false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue