one failing test in Person. i have no idea.
This commit is contained in:
parent
d6bc93fb96
commit
42c0b82068
2 changed files with 10 additions and 8 deletions
|
|
@ -10,13 +10,10 @@ class User
|
|||
|
||||
one :person, :class_name => 'Person', :foreign_key => :owner_id
|
||||
|
||||
key :friend_ids, Array
|
||||
key :pending_friend_ids, Array
|
||||
|
||||
many :friends, :class_name => 'Person'
|
||||
|
||||
def friends
|
||||
Person.all(:id => self.friend_ids)
|
||||
end
|
||||
|
||||
def pending_friends
|
||||
Person.all(:id => self.pending_friend_ids)
|
||||
|
|
@ -76,8 +73,9 @@ class User
|
|||
|
||||
|
||||
puts bad_friend.users.count
|
||||
puts self.friends.inspect
|
||||
|
||||
self.friend_ids.delete( friend_id )
|
||||
self.friends.delete( friend_id )
|
||||
self.save
|
||||
|
||||
bad_friend.users.delete( self.id )
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ describe Person do
|
|||
person = Factory.create(:person)
|
||||
|
||||
person.users << user
|
||||
user.friend_ids << person.id
|
||||
user.friends << person
|
||||
|
||||
Person.all.count.should == 2
|
||||
user.friends.count.should == 1
|
||||
|
|
@ -68,11 +68,15 @@ describe Person do
|
|||
|
||||
person = Factory.create(:person)
|
||||
|
||||
|
||||
person.users << user_one
|
||||
person.users << user_two
|
||||
person.save
|
||||
|
||||
user_one.friend_ids << person.id
|
||||
user_two.friend_ids << person.id
|
||||
user_one.friends << person
|
||||
user_two.friends << person
|
||||
user_one.save
|
||||
user_two.save
|
||||
|
||||
Person.all.count.should == 3
|
||||
user_one.friends.count.should == 1
|
||||
|
|
|
|||
Loading…
Reference in a new issue