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

@@ -74,7 +74,16 @@ class ForumTopicsControllerTest < ActionController::TestCase
end
context "destroy action" do
setup do
@post = Factory.create(:forum_post, :topic_id => @forum_topic.id)
end
should "destroy the topic and any associated posts" do
assert_difference(["ForumPost.count", "ForumTopic.count"], -1) do
post :destroy, {:id => @forum_topic.id}, {:user_id => @user.id}
end
assert_redirected_to(forum_topics_path)
end
end
end
end