fix tests
This commit is contained in:
@@ -8,7 +8,7 @@ class CommentVotesController < ApplicationController
|
||||
@comment_vote = @comment.vote!(params[:score])
|
||||
rescue CommentVote::Error, ActiveRecord::RecordInvalid => x
|
||||
@error = x
|
||||
render status: 500
|
||||
render status: 422
|
||||
end
|
||||
|
||||
def destroy
|
||||
@@ -16,6 +16,6 @@ class CommentVotesController < ApplicationController
|
||||
@comment.unvote!
|
||||
rescue CommentVote::Error => x
|
||||
@error = x
|
||||
render status: 500
|
||||
render status: 422
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
<% if @comment_vote.errors.any? %>
|
||||
<% if @error %>
|
||||
{"success": false, "errors": <%= @error.to_s.to_json.html_safe %>}
|
||||
<% elsif @comment_vote.errors.any? %>
|
||||
{"success": false, "errors": <%= @comment_vote.errors.full_messages.to_json.html_safe %>}
|
||||
<% else %>
|
||||
{"success": true}
|
||||
|
||||
Reference in New Issue
Block a user