Use to_json call for accounts API (#38226)

This commit is contained in:
Matt Jankowski 2026-03-16 10:40:03 -04:00 committed by GitHub
parent 7933fa4f94
commit 8ed13bc6f7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 2 deletions

View File

@ -38,7 +38,7 @@ class Api::V1::AccountsController < Api::BaseController
headers.merge!(response.headers)
self.response_body = Oj.dump(response.body)
self.response_body = response.body.to_json
self.status = response.status
rescue ActiveRecord::RecordInvalid => e
render json: ValidationErrorFormatter.new(e, 'account.username': :username, 'invite_request.text': :reason).as_json, status: 422

View File

@ -185,7 +185,12 @@ RSpec.describe '/api/v1/accounts' do
expect(response).to have_http_status(200)
expect(response.content_type)
.to start_with('application/json')
expect(response.parsed_body[:access_token]).to_not be_blank
expect(response.parsed_body)
.to include(
access_token: be_present,
created_at: be_a(Integer),
token_type: 'Bearer'
)
user = User.find_by(email: 'hello@world.tld')
expect(user).to_not be_nil