Clean up specs a little, fix unfriending
This commit is contained in:
parent
1bd54aba63
commit
0758f9245f
3 changed files with 13 additions and 14 deletions
|
|
@ -89,7 +89,10 @@ module Diaspora
|
|||
def remove_friend(bad_friend)
|
||||
raise "Friend not deleted" unless self.friend_ids.delete( bad_friend.id )
|
||||
aspects.each{|aspect|
|
||||
aspect.person_ids.delete( bad_friend.id )}
|
||||
if aspect.person_ids.delete( bad_friend.id )
|
||||
aspect.posts.delete_if { |post|
|
||||
post.person_id == bad_friend.id}
|
||||
end}
|
||||
self.save
|
||||
|
||||
self.raw_visible_posts.find_all_by_person_id( bad_friend.id ).each{|post|
|
||||
|
|
|
|||
|
|
@ -153,7 +153,7 @@ describe Diaspora::Parser do
|
|||
person.save
|
||||
|
||||
#Cache profile for checking against marshaled profile
|
||||
old_profile = person.profile
|
||||
old_profile = person.profile.dup
|
||||
old_profile.first_name.should == 'bob'
|
||||
|
||||
#Build xml for profile, clear profile
|
||||
|
|
|
|||
|
|
@ -160,22 +160,18 @@ describe User do
|
|||
describe 'unfriending' do
|
||||
before do
|
||||
friend_users(user,aspect, user2, aspect2)
|
||||
user.reload
|
||||
user2.reload
|
||||
end
|
||||
|
||||
it 'should unfriend the other user on the same seed' do
|
||||
user.friends.count.should == 1
|
||||
user2.friends.count.should == 1
|
||||
lambda {user2.unfriend user.person}.should change{
|
||||
user2.friends.count}.by(-1)
|
||||
aspect2.people.count.should == 0
|
||||
end
|
||||
|
||||
user2.unfriend user.person
|
||||
user2.reload
|
||||
|
||||
user2.friends.count.should == 0
|
||||
user.unfriended_by user2.person
|
||||
|
||||
aspect.reload.people.count.should == 0
|
||||
aspect2.reload.people.count.should == 0
|
||||
it 'is unfriended by another user' do
|
||||
lambda {user.unfriended_by user2.person}.should change{
|
||||
user.friends.count}.by(-1)
|
||||
aspect.people.count.should == 0
|
||||
end
|
||||
|
||||
context 'with a post' do
|
||||
|
|
|
|||
Loading…
Reference in a new issue