From 0276792b35700bc9575dccbe8b1bd9fec0d54951 Mon Sep 17 00:00:00 2001 From: evazion Date: Tue, 23 Jun 2020 02:43:12 -0500 Subject: [PATCH] BURs: add test for users voting on their own BURs (#4527) --- test/functional/forum_post_votes_controller_test.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/functional/forum_post_votes_controller_test.rb b/test/functional/forum_post_votes_controller_test.rb index 7143c038d..5d693d26b 100644 --- a/test/functional/forum_post_votes_controller_test.rb +++ b/test/functional/forum_post_votes_controller_test.rb @@ -36,6 +36,13 @@ class ForumPostVotesControllerTest < ActionDispatch::IntegrationTest assert_response 403 end end + + should "not allow creators to vote on their own BURs" do + assert_difference("ForumPostVote.count", 0) do + post_auth forum_post_votes_path(format: :js), @bulk_update_request.user, params: { forum_post_id: @forum_post.id, forum_post_vote: { score: 1 }} + assert_response 403 + end + end end context "destroy action" do