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

Post deletion now deletes comments

parent 469599a4
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -23,6 +23,7 @@ class Post
after_save :notify_friends
before_destroy :propagate_delete
after_destroy :destroy_comments
def self.stream
Post.sort(:created_at.desc).all
......@@ -43,6 +44,10 @@ class Post
protected
def destroy_comments
comments.each{|c| c.destroy}
end
def propagate_delete
Retraction.for(self).notify_friends
end
......
......@@ -83,5 +83,15 @@ describe Post do
(message.to_xml.to_s.include? @user.email).should == true
end
end
describe 'deletion' do
it 'should delete a posts comments on delete' do
post = Factory.create(:status_message, :person => @user)
@user.comment "hey", :on=> post
post.destroy
Post.all(:id => post.id).empty?.should == true
Comment.all(:text => "hey").empty?.should == true
end
end
end
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