tests: fixup post votes, comment votes controller tests.

This commit is contained in:
evazion
2019-10-28 16:52:02 -05:00
parent 4bb1bdbe10
commit 68c74ed9d8
2 changed files with 5 additions and 5 deletions

View File

@@ -17,7 +17,7 @@ class CommentVotesControllerTest < ActionDispatch::IntegrationTest
context "#create.json" do
should "create a vote" do
assert_difference("CommentVote.count", 1) do
post_auth comment_votes_path(comment_id: @comment.id, score: "down"), @user, as: :json
post_auth comment_comment_votes_path(comment_id: @comment.id, score: "down"), @user, as: :json
assert_response :success
assert_equal(@comment.id, response.parsed_body["id"])
@@ -28,7 +28,7 @@ class CommentVotesControllerTest < ActionDispatch::IntegrationTest
should "fail silently on errors" do
create(:comment_vote, comment: @comment, score: -1)
assert_difference("CommentVote.count", 0) do
post_auth comment_votes_path(comment_id: @comment.id, score: "down", format: "json"), @user
post_auth comment_comment_votes_path(comment_id: @comment.id, score: "down", format: "json"), @user
assert_response 422
comment = JSON.parse(@response.body)
@@ -41,7 +41,7 @@ class CommentVotesControllerTest < ActionDispatch::IntegrationTest
context "#create.js" do
should "create a vote" do
assert_difference("CommentVote.count", 1) do
post_auth comment_votes_path(comment_id: @comment.id, format: "json", score: "down"), @user
post_auth comment_comment_votes_path(comment_id: @comment.id, format: "json", score: "down"), @user
assert_response :success
end
end
@@ -49,7 +49,7 @@ class CommentVotesControllerTest < ActionDispatch::IntegrationTest
should "fail on errors" do
create(:comment_vote, :comment => @comment, :score => -1)
assert_difference("CommentVote.count", 0) do
post_auth comment_votes_path(comment_id: @comment.id, :score => "down", format: "js"), @user
post_auth comment_comment_votes_path(comment_id: @comment.id, :score => "down", format: "js"), @user
assert_response 422
end
end

View File

@@ -12,7 +12,7 @@ class PostVotesControllerTest < ActionDispatch::IntegrationTest
context "index action" do
should "work" do
as(@user) { create(:post_vote, post_id: @post.id, user_id: @user.id) }
get post_votes_path
get_auth post_votes_path, @user
assert_response :success
end