Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API: rename poll_answer_id to poll_answer in post interactions vote endpoint #8097

Merged
merged 1 commit into from Feb 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/controllers/api/v1/post_interactions_controller.rb
Expand Up @@ -58,7 +58,7 @@ def report
def vote
post = find_post
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
# This, but not the find_post above, should return a 422,
# we just keep poll_vote nil so it goes into the else below
Expand Down
32 changes: 16 additions & 16 deletions spec/integration/api/post_interactions_controller_spec.rb
Expand Up @@ -365,8 +365,8 @@
post(
api_v1_post_vote_path(@poll_post.guid),
params: {
poll_answer_id: @poll_answer.id,
access_token: access_token
poll_answer: @poll_answer.id,
access_token: access_token
}
)
expect(response.status).to eq(204)
Expand All @@ -377,16 +377,16 @@
post(
api_v1_post_vote_path(@poll_post.guid),
params: {
poll_answer_id: @poll_answer.id,
access_token: access_token
poll_answer: @poll_answer.id,
access_token: access_token
}
)
expect(response.status).to eq(204)
post(
api_v1_post_vote_path(@poll_post.guid),
params: {
poll_answer_id: @poll_answer.id,
access_token: access_token
poll_answer: @poll_answer.id,
access_token: access_token
}
)
confirm_api_error(response, 422, "Cant vote on this post")
Expand All @@ -396,8 +396,8 @@
post(
api_v1_post_vote_path(@poll_post.guid),
params: {
poll_answer_id: -1,
access_token: access_token
poll_answer: -1,
access_token: access_token
}
)
confirm_api_error(response, 422, "Cant vote on this post")
Expand All @@ -407,8 +407,8 @@
post(
api_v1_post_vote_path("999_999_999"),
params: {
poll_answer_id: @poll_answer.id,
access_token: access_token
poll_answer: @poll_answer.id,
access_token: access_token
}
)
confirm_api_error(response, 404, "Post with provided guid could not be found")
Expand All @@ -418,8 +418,8 @@
post(
api_v1_post_vote_path(@poll_post.guid),
params: {
poll_answer_id: @poll_answer.id,
access_token: access_token_minimum_scopes
poll_answer: @poll_answer.id,
access_token: access_token_minimum_scopes
}
)
expect(response.status).to eq(403)
Expand All @@ -429,8 +429,8 @@
post(
api_v1_post_vote_path(@shared_post.guid),
params: {
poll_answer_id: @poll_answer.id,
access_token: access_token_public_only
poll_answer: @poll_answer.id,
access_token: access_token_public_only
}
)
expect(response.status).to eq(404)
Expand All @@ -440,8 +440,8 @@
post(
api_v1_post_vote_path(@poll_post.guid),
params: {
poll_answer_id: @poll_answer.id,
access_token: invalid_token
poll_answer: @poll_answer.id,
access_token: invalid_token
}
)
expect(response.status).to eq(401)
Expand Down