-
Notifications
You must be signed in to change notification settings - Fork 25
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
Read-only Bans API #345
base: master
Are you sure you want to change the base?
Read-only Bans API #345
Conversation
In order to reduce traffic for the use case of #344, I would prefer to have a relationship on users called |
@@ -0,0 +1,5 @@ | |||
module JsonHelpers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of this, use response.parsed_body
. It automagically decodes the json.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did try to use response.parsed_body
but it ended up parsing the response as a string, even with as: :json
(get :bans, params: { id: user.id }, as: :json
). I just created this helper instead 🤷♂️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It works for the other API requests.
@@ -0,0 +1,43 @@ | |||
require 'rails_helper' | |||
|
|||
describe API::V1::UsersController do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yea, completely missed this. The API is tested with request tests, eg. spec/requests/api/v1/users_spec.rb
.
Exposes user bans through the read-only API.
Fixes #344