diff --git a/app/controllers/api/v1/registrant/contacts_controller.rb b/app/controllers/api/v1/registrant/contacts_controller.rb index 31d56885b..f252b3acd 100644 --- a/app/controllers/api/v1/registrant/contacts_controller.rb +++ b/app/controllers/api/v1/registrant/contacts_controller.rb @@ -31,7 +31,7 @@ module Api if @contact render json: @contact else - render json: { errors: ['Contact not found'] }, status: :not_found + render json: { errors: [{ base: ['Contact not found'] }] }, status: :not_found end end diff --git a/test/integration/api/registrant/registrant_api_contacts_test.rb b/test/integration/api/registrant/registrant_api_contacts_test.rb index a3367dd58..ff51494af 100644 --- a/test/integration/api/registrant/registrant_api_contacts_test.rb +++ b/test/integration/api/registrant/registrant_api_contacts_test.rb @@ -50,7 +50,7 @@ class RegistrantApiContactsTest < ActionDispatch::IntegrationTest assert_equal(401, response.status) json_body = JSON.parse(response.body, symbolize_names: true) - assert_equal({ errors: ['Not authorized'] }, json_body) + assert_equal({ errors: [base: ['Not authorized']] }, json_body) end def test_details_returns_401_without_authorization @@ -58,7 +58,7 @@ class RegistrantApiContactsTest < ActionDispatch::IntegrationTest assert_equal(401, response.status) json_body = JSON.parse(response.body, symbolize_names: true) - assert_equal({ errors: ['Not authorized'] }, json_body) + assert_equal({ errors: [base: ['Not authorized']] }, json_body) end def test_details_returns_404_for_non_existent_contact @@ -66,7 +66,7 @@ class RegistrantApiContactsTest < ActionDispatch::IntegrationTest assert_equal(404, response.status) json_body = JSON.parse(response.body, symbolize_names: true) - assert_equal({ errors: ['Contact not found'] }, json_body) + assert_equal({ errors: [base: ['Contact not found']] }, json_body) end private