# frozen_string_literal: true require 'test_helper' module Admin class CommentControllerTest < ActionDispatch::IntegrationTest test "should post update" do auth_manager comment = quiz_comments(:com5) post admin_update_comment_url(test_hash: comment.test_hash, id: comment.id), params: { quiz_comment: { message: 'updated comment' } } assert_redirected_to admin_result_url(test_hash: comment.test_hash) assert flash[:success] refute_equal comment.message, QuizComment.find_by(id: comment.id).message end test "should post create" do auth_reviewer candidate = candidates(:stacy) assert_difference("QuizComment.count") do post admin_create_comment_url(test_hash: candidate.test_hash), params: { quiz_comment: { message: 'this is a test comment' } } end assert_redirected_to admin_result_url(test_hash: candidate.test_hash) assert flash[:success] end end end