API: rename poll_answer_id to poll_answer in post interactions vote endpoint

This commit is contained in:
Jonne Haß 2020-02-02 19:08:58 +01:00
parent b1f357849b
commit 884de9008f
2 changed files with 17 additions and 17 deletions

View file

@ -58,7 +58,7 @@ module Api
def vote def vote
post = find_post post = find_post
begin begin
poll_vote = poll_service.vote(post.id, params[:poll_answer_id]) poll_vote = poll_service.vote(post.id, params[:poll_answer])
rescue ActiveRecord::RecordNotFound rescue ActiveRecord::RecordNotFound
# This, but not the find_post above, should return a 422, # This, but not the find_post above, should return a 422,
# we just keep poll_vote nil so it goes into the else below # we just keep poll_vote nil so it goes into the else below

View file

@ -365,8 +365,8 @@ describe Api::V1::PostInteractionsController do
post( post(
api_v1_post_vote_path(@poll_post.guid), api_v1_post_vote_path(@poll_post.guid),
params: { params: {
poll_answer_id: @poll_answer.id, poll_answer: @poll_answer.id,
access_token: access_token access_token: access_token
} }
) )
expect(response.status).to eq(204) expect(response.status).to eq(204)
@ -377,16 +377,16 @@ describe Api::V1::PostInteractionsController do
post( post(
api_v1_post_vote_path(@poll_post.guid), api_v1_post_vote_path(@poll_post.guid),
params: { params: {
poll_answer_id: @poll_answer.id, poll_answer: @poll_answer.id,
access_token: access_token access_token: access_token
} }
) )
expect(response.status).to eq(204) expect(response.status).to eq(204)
post( post(
api_v1_post_vote_path(@poll_post.guid), api_v1_post_vote_path(@poll_post.guid),
params: { params: {
poll_answer_id: @poll_answer.id, poll_answer: @poll_answer.id,
access_token: access_token access_token: access_token
} }
) )
confirm_api_error(response, 422, "Cant vote on this post") confirm_api_error(response, 422, "Cant vote on this post")
@ -396,8 +396,8 @@ describe Api::V1::PostInteractionsController do
post( post(
api_v1_post_vote_path(@poll_post.guid), api_v1_post_vote_path(@poll_post.guid),
params: { params: {
poll_answer_id: -1, poll_answer: -1,
access_token: access_token access_token: access_token
} }
) )
confirm_api_error(response, 422, "Cant vote on this post") confirm_api_error(response, 422, "Cant vote on this post")
@ -407,8 +407,8 @@ describe Api::V1::PostInteractionsController do
post( post(
api_v1_post_vote_path("999_999_999"), api_v1_post_vote_path("999_999_999"),
params: { params: {
poll_answer_id: @poll_answer.id, poll_answer: @poll_answer.id,
access_token: access_token access_token: access_token
} }
) )
confirm_api_error(response, 404, "Post with provided guid could not be found") confirm_api_error(response, 404, "Post with provided guid could not be found")
@ -418,8 +418,8 @@ describe Api::V1::PostInteractionsController do
post( post(
api_v1_post_vote_path(@poll_post.guid), api_v1_post_vote_path(@poll_post.guid),
params: { params: {
poll_answer_id: @poll_answer.id, poll_answer: @poll_answer.id,
access_token: access_token_minimum_scopes access_token: access_token_minimum_scopes
} }
) )
expect(response.status).to eq(403) expect(response.status).to eq(403)
@ -429,8 +429,8 @@ describe Api::V1::PostInteractionsController do
post( post(
api_v1_post_vote_path(@shared_post.guid), api_v1_post_vote_path(@shared_post.guid),
params: { params: {
poll_answer_id: @poll_answer.id, poll_answer: @poll_answer.id,
access_token: access_token_public_only access_token: access_token_public_only
} }
) )
expect(response.status).to eq(404) expect(response.status).to eq(404)
@ -440,8 +440,8 @@ describe Api::V1::PostInteractionsController do
post( post(
api_v1_post_vote_path(@poll_post.guid), api_v1_post_vote_path(@poll_post.guid),
params: { params: {
poll_answer_id: @poll_answer.id, poll_answer: @poll_answer.id,
access_token: invalid_token access_token: invalid_token
} }
) )
expect(response.status).to eq(401) expect(response.status).to eq(401)