Skip to content
Extraits de code Groupes Projets
Valider a9c9619a rédigé par ilya's avatar ilya
Parcourir les fichiers

DG IZ; posting from a user includes adding to the many posts association in said user

parent 5761d5db
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -44,7 +44,11 @@ class User
post = model_class.instantiate(options)
post.creator_signature = post.sign_with_key(encryption_key)
post.notify_people
post.socket_to_uid owner.id if (owner_id && post.respond_to?( :socket_to_uid))
post.socket_to_uid owner.id if (owner_id && post.respond_to?(:socket_to_uid))
self.posts << post
self.save
post
end ######### Posts and Such ###############
......
......@@ -283,6 +283,12 @@ describe User do
@user.posts.count.should == 0
end
it "should add the post to that user's posts when a user posts it" do
status_message = @user.post :status_message, :message => "hi"
@user.reload
@user.posts.include?(status_message).should be true
end
it 'should be removed on unfriending' do
status_message = @user2.post :status_message, :message => "hi"
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter