diff --git a/app/models/user.rb b/app/models/user.rb index cdac36fc7b03c19d24d9a218b52c9b5343027adb..3641124056100348f3f6fb99a41aa9183da98cd1 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 6a62b5ba34feea3a42d81f88aaa42e3433799c1f..55c1105ec6bc44750e698635becfd39859441913 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