From 59fdff5dc5f0a4251909f73d6681b3e579fff857 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Mon, 17 Nov 2025 09:13:52 -0500 Subject: [PATCH] Add spec for translation attempt with ineligible target language (#36813) --- .../requests/api/v1/statuses/translations_spec.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/spec/requests/api/v1/statuses/translations_spec.rb b/spec/requests/api/v1/statuses/translations_spec.rb index e95ec1b101..eb17d9f6a7 100644 --- a/spec/requests/api/v1/statuses/translations_spec.rb +++ b/spec/requests/api/v1/statuses/translations_spec.rb @@ -50,6 +50,21 @@ RSpec.describe 'API V1 Statuses Translations' do end end + context 'with a public status marked with the same language as the current locale when translation backend cannot do same-language translation' do + let(:status) { Fabricate(:status, account: user.account, text: 'Esto está en español pero está marcado como inglés.', language: 'en') } + + it 'returns http forbidden with error message' do + subject + + expect(response) + .to have_http_status(403) + expect(response.media_type) + .to eq('application/json') + expect(response.parsed_body) + .to include(error: /not allowed/) + end + end + context 'with a private status' do let(:status) { Fabricate(:status, visibility: :private, account: user.account, text: 'Hola', language: 'es') }