Fix spec for api/v1/statuses/translations (#23956)

This commit is contained in:
Matt Jankowski 2023-03-04 17:17:46 -05:00 committed by GitHub
parent 2d1ccb3d8b
commit c599e289d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -15,11 +15,12 @@ describe Api::V1::Statuses::TranslationsController do
end end
describe 'POST #create' do describe 'POST #create' do
let(:status) { Fabricate(:status, account: user.account) } let(:status) { Fabricate(:status, account: user.account, text: 'Hola', language: 'es') }
before do before do
translation = TranslationService::Translation.new(text: 'Hello') translation = TranslationService::Translation.new(text: 'Hello')
service = instance_double(TranslationService::DeepL, translate: translation) service = instance_double(TranslationService::DeepL, translate: translation, supported?: true)
allow(TranslationService).to receive(:configured?).and_return(true)
allow(TranslationService).to receive(:configured).and_return(service) allow(TranslationService).to receive(:configured).and_return(service)
post :create, params: { status_id: status.id } post :create, params: { status_id: status.id }
end end