From 0890c6320be27338e658ae63f93e9ab1cb17c528 Mon Sep 17 00:00:00 2001 From: evazion Date: Mon, 6 Feb 2017 16:57:07 -0600 Subject: [PATCH] tests: add more comments controller tests. --- test/functional/comments_controller_test.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/functional/comments_controller_test.rb b/test/functional/comments_controller_test.rb index eb54597a6..b597bf37c 100644 --- a/test/functional/comments_controller_test.rb +++ b/test/functional/comments_controller_test.rb @@ -22,6 +22,11 @@ class CommentsControllerTest < ActionController::TestCase end context "index action" do + should "render for post" do + xhr :get, :index, { post_id: @post.id, group_by: "post", format: "js" } + assert_response :success + end + should "render by post" do get :index, {:group_by => "post"} assert_response :success @@ -142,5 +147,15 @@ class CommentsControllerTest < ActionController::TestCase assert_redirected_to @comment end end + + context "undelete action" do + should "mark comment as undeleted" do + @comment.delete! + put :undelete, { id: @comment.id }, { user_id: @user.id } + + assert_equal(false, @comment.reload.is_deleted) + assert_redirected_to(@comment) + end + end end end