fixed tests

This commit is contained in:
albert
2012-03-12 18:22:44 -04:00
parent dd5a965884
commit 9fb0f16f01
3 changed files with 42 additions and 9 deletions

View File

@@ -79,10 +79,23 @@ class ForumTopicsControllerTest < ActionController::TestCase
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)
post :destroy, {:id => @forum_topic.id}, {:user_id => @user.id}
assert_redirected_to(forum_topic_path(@forum_topic))
@forum_topic.reload
assert_equal(true, @forum_topic.is_deleted?)
end
end
context "undelete action" do
setup do
@forum_topic.update_attribute(:is_deleted, true)
end
should "restore the topic" do
post :undelete, {:id => @forum_topic.id}, {:user_id => @user.id}
assert_redirected_to(forum_topic_path(@forum_topic))
@forum_topic.reload
assert_equal(false, @forum_topic.is_deleted?)
end
end
end