Fix failures in commenting tests.

Restricting users from upvoting their own comments broke some tests.
Switch these tests to downvoting instead.
This commit is contained in:
evazion
2016-12-03 20:06:50 -06:00
parent 4f2988c809
commit 01afc46f74
3 changed files with 6 additions and 6 deletions

View File

@@ -24,9 +24,9 @@ class CommentVotesControllerTest < ActionController::TestCase
end
should "fail silently on errors" do
FactoryGirl.create(:comment_vote, :comment => @comment)
FactoryGirl.create(:comment_vote, :comment => @comment, :score => -1)
assert_difference("CommentVote.count", 0) do
post :create, {:format => "json", :comment_id => @comment.id, :score => 1}, {:user_id => @user.id}
post :create, {:format => "json", :comment_id => @comment.id, :score => -1}, {:user_id => @user.id}
assert_response 422
assert_equal("{\"errors\":{\"user_id\":[\"have already voted for this comment\"]}}", @response.body.strip)
end
@@ -42,9 +42,9 @@ class CommentVotesControllerTest < ActionController::TestCase
end
should "fail silently on errors" do
FactoryGirl.create(:comment_vote, :comment => @comment)
FactoryGirl.create(:comment_vote, :comment => @comment, :score => -1)
assert_difference("CommentVote.count", 0) do
post :create, {:format => "js", :comment_id => @comment.id, :score => 1}, {:user_id => @user.id}
post :create, {:format => "js", :comment_id => @comment.id, :score => -1}, {:user_id => @user.id}
assert_response :success
end
end