fix: Update ActiveStorage::FileNotFoundError error and fix the captain condition in audio transcription (#11779)

Update the error to `ActiveStorage::FileNotFoundError`. Fix the
condition to enable audio transcription and added a spec for it.
This commit is contained in:
Pranav
2025-06-20 13:20:55 -07:00
committed by GitHub
parent a2857cac38
commit ea4477ccde
3 changed files with 12 additions and 2 deletions

View File

@@ -18,6 +18,16 @@ RSpec.describe Messages::AudioTranscriptionService, type: :service do
describe '#perform' do
let(:service) { described_class.new(attachment) }
context 'when captain_integration feature is not enabled' do
before do
account.disable_features!('captain_integration')
end
it 'returns transcription limit exceeded' do
expect(service.perform).to eq({ error: 'Transcription limit exceeded' })
end
end
context 'when transcription is successful' do
before do
# Mock can_transcribe? to return true and transcribe_audio method