Add a spec to user, fix a cucumber step for mysql
This commit is contained in:
parent
5a1bd13831
commit
3d7d8b51d2
3 changed files with 12 additions and 2 deletions
|
|
@ -27,7 +27,7 @@ class User < ActiveRecord::Base
|
||||||
validates_associated :person
|
validates_associated :person
|
||||||
|
|
||||||
has_one :person, :foreign_key => :owner_id
|
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_from_me, :class_name => 'Invitation', :foreign_key => :sender_id
|
||||||
has_many :invitations_to_me, :class_name => 'Invitation', :foreign_key => :recipient_id
|
has_many :invitations_to_me, :class_name => 'Invitation', :foreign_key => :recipient_id
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ When /^I wait for the aspects page to load$/ do
|
||||||
end
|
end
|
||||||
|
|
||||||
When /^I wait for the request's profile page to load$/ do
|
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
|
end
|
||||||
|
|
||||||
When /^I wait for the ajax to finish$/ do
|
When /^I wait for the ajax to finish$/ do
|
||||||
|
|
|
||||||
|
|
@ -262,6 +262,16 @@ describe User do
|
||||||
user.update_profile(params).should be_true
|
user.update_profile(params).should be_true
|
||||||
user.reload.profile.image_url.should == "http://clown.com"
|
user.reload.profile.image_url.should == "http://clown.com"
|
||||||
end
|
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
|
it "only pushes to non-pending contacts" do
|
||||||
connect_users(user, aspect, user2, aspect2)
|
connect_users(user, aspect, user2, aspect2)
|
||||||
user.contacts.count.should == 1
|
user.contacts.count.should == 1
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue