pushing the profile to to all the contacts

This commit is contained in:
zhitomirskiyi 2010-12-09 11:51:22 -08:00
parent fa9caf00ca
commit 23d2a92bf1
2 changed files with 10 additions and 4 deletions

View file

@ -331,7 +331,7 @@ class User
########### Profile ######################
def update_profile(params)
if self.person.profile.update_attributes(params)
push_to_aspects profile, aspects
push_to_people profile, self.person_objects(contacts)
true
else
false

View file

@ -263,15 +263,21 @@ describe User do
end
context 'profiles' do
it 'should be able to update their profile and send it to their contacts' do
updated_profile = {
let(:updated_profile) {{
:first_name => 'bob',
:last_name => 'billytown',
:image_url => "http://clown.com"}
:image_url => "http://clown.com"}}
it 'should be able to update their profile' do
user.update_profile(updated_profile).should be true
user.reload.profile.image_url.should == "http://clown.com"
end
it 'sends a profile to their contacts' do
connect_users(user, aspect, user2, aspect2)
user.should_receive(:push_to_person).once
user.update_profile(updated_profile).should be true
end
end
context 'aspects' do