Make sure that not deleting the service_users doesn't leave them stale

This commit is contained in:
Raphael Sofaer 2011-08-03 15:39:23 -07:00
parent 7d0c796762
commit 1aac60bee3
2 changed files with 13 additions and 1 deletions

View file

@ -47,6 +47,6 @@ class Services::Facebook < Service
su.attach_local_models su.attach_local_models
su su
} }
ServiceUser.import(data) ServiceUser.import(data, :on_duplicate_key_update => [:updated_at, :contact_id, :person_id, :request_id, :invitation_id, :photo_url, :name])
end end
end end

View file

@ -71,6 +71,18 @@ JSON
@service.save_friends @service.save_friends
@service.service_users.first.person.should == @user2.person @service.service_users.first.person.should == @user2.person
end end
it 'overwrites local model information' do
@service.save_friends
su = @service.service_users.first
su.person.should == @user2.person
su.contact.should == nil
connect_users_with_aspects(alice, @user2)
@service.save_friends
su.person.should == @user2.person
su.reload.contact.should == alice.contact_for(@user2.person)
end
end end
describe '#finder' do describe '#finder' do