deleting a forum topic should delete its posts

This commit is contained in:
albert
2011-01-12 18:06:46 -05:00
parent 668fbab77a
commit d6f1d09da0
3 changed files with 24 additions and 1 deletions

View File

@@ -42,5 +42,19 @@ class ForumTopicTest < ActiveSupport::TestCase
assert_equal(@second_user.id, @topic.updater_id)
end
end
context "with multiple posts that has been deleted" do
setup do
5.times do
Factory.create(:forum_post, :topic_id => @topic.id)
end
end
should "delete any associated posts" do
assert_difference("ForumPost.count", -5) do
@topic.destroy
end
end
end
end
end