diff --git a/app/models/user.rb b/app/models/user.rb index aeced510ccd8b3b5f896662c0eaa455e4c0f6084..13b74a0f1b58c29d182cdc7c18085b88c90e1226 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -27,7 +27,7 @@ class User < ActiveRecord::Base validates_associated :person has_one :person, :foreign_key => :owner_id - delegate :public_key, :posts, :owns?, :diaspora_handle, :name, :public_url, :profile, :to => :person + delegate :public_key, :posts, :owns?, :diaspora_handle, :name, :public_url, :profile, :first_name, :last_name, :to => :person has_many :invitations_from_me, :class_name => 'Invitation', :foreign_key => :sender_id has_many :invitations_to_me, :class_name => 'Invitation', :foreign_key => :recipient_id diff --git a/features/step_definitions/custom_web_steps.rb b/features/step_definitions/custom_web_steps.rb index 88a82d4e44e6d0c963d58c2a6fb382950679dc43..e12e383f0831c59f0864e87c292df74304fe7ce2 100644 --- a/features/step_definitions/custom_web_steps.rb +++ b/features/step_definitions/custom_web_steps.rb @@ -37,7 +37,7 @@ When /^I wait for the aspects page to load$/ do end When /^I wait for the request's profile page to load$/ do - wait_until { current_path == person_path(Request.to(@me).first.from) } + wait_until { current_path == person_path(Request.where(:recipient_id => @me.id).first.sender) } end When /^I wait for the ajax to finish$/ do diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index a41f8078672483b6b9cb8aaecd426445baac1968..03f6e285185175173cbce712ca07a83a468dcf92 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -262,6 +262,16 @@ describe User do user.update_profile(params).should be_true user.reload.profile.image_url.should == "http://clown.com" end + + it 'only pushes to a given person once' do + connect_users(user, aspect, user2, aspect2) + user.add_contact_to_aspect(user.contact_for(user2.person), + user.aspects.create(:name => "Newsies")) + + user.should_receive(:push_to_person).once + user.update_profile(@params).should be_true + end + it "only pushes to non-pending contacts" do connect_users(user, aspect, user2, aspect2) user.contacts.count.should == 1