pushing the profile to to all the contacts
This commit is contained in:
parent
fa9caf00ca
commit
23d2a92bf1
2 changed files with 10 additions and 4 deletions
|
|
@ -331,7 +331,7 @@ class User
|
||||||
########### Profile ######################
|
########### Profile ######################
|
||||||
def update_profile(params)
|
def update_profile(params)
|
||||||
if self.person.profile.update_attributes(params)
|
if self.person.profile.update_attributes(params)
|
||||||
push_to_aspects profile, aspects
|
push_to_people profile, self.person_objects(contacts)
|
||||||
true
|
true
|
||||||
else
|
else
|
||||||
false
|
false
|
||||||
|
|
|
||||||
|
|
@ -263,15 +263,21 @@ describe User do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'profiles' do
|
context 'profiles' do
|
||||||
it 'should be able to update their profile and send it to their contacts' do
|
let(:updated_profile) {{
|
||||||
updated_profile = {
|
|
||||||
:first_name => 'bob',
|
:first_name => 'bob',
|
||||||
:last_name => 'billytown',
|
: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.update_profile(updated_profile).should be true
|
||||||
user.reload.profile.image_url.should == "http://clown.com"
|
user.reload.profile.image_url.should == "http://clown.com"
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
context 'aspects' do
|
context 'aspects' do
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue