fix specs in contact

This commit is contained in:
danielgrippi 2011-11-03 20:48:02 -07:00
parent bb19531195
commit acf6936d7c

View file

@ -4,7 +4,6 @@
class Contact < ActiveRecord::Base class Contact < ActiveRecord::Base
belongs_to :user belongs_to :user
validates_presence_of :user
belongs_to :person belongs_to :person
validates :person, :presence => true validates :person, :presence => true
@ -18,6 +17,7 @@ class Contact < ActiveRecord::Base
validate :not_contact_for_self, validate :not_contact_for_self,
:not_blocked_user :not_blocked_user
validates_presence_of :user
validates_uniqueness_of :person_id, :scope => :user_id validates_uniqueness_of :person_id, :scope => :user_id
before_destroy :destroy_notifications, before_destroy :destroy_notifications,
@ -101,7 +101,7 @@ class Contact < ActiveRecord::Base
end end
def not_blocked_user def not_blocked_user
if user.blocks.where(:person_id => person_id).exists? if user && user.blocks.where(:person_id => person_id).exists?
errors[:base] << 'Cannot connect to an ignored user' errors[:base] << 'Cannot connect to an ignored user'
false false
else else