diff options
Diffstat (limited to 'test/functional/comments_controller_test.rb')
-rw-r--r-- | test/functional/comments_controller_test.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/functional/comments_controller_test.rb b/test/functional/comments_controller_test.rb index 1a9d628d8..1887c4896 100644 --- a/test/functional/comments_controller_test.rb +++ b/test/functional/comments_controller_test.rb @@ -43,4 +43,15 @@ class CommentsControllerTest < ActionController::TestCase assert_redirected_to 'news/1' end end + + def test_destroy_comment + comments_count = News.find(1).comments.size + @request.session[:user_id] = 2 + delete :destroy, :id => 1, :comment_id => 2 + assert_redirected_to 'news/1' + assert_nil Comment.find_by_id(2) + assert_equal comments_count - 1, News.find(1).comments.size + end + + end |