diff --git a/app/models/user.rb b/app/models/user.rb index cdac36fc7..364112405 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -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 diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 6a62b5ba3..55c1105ec 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -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