Skip to content

Commit

Permalink
Add test coverage for POST /api/v2/media's max description length (ma…
Browse files Browse the repository at this point in the history
  • Loading branch information
ThisIsMissEm authored Oct 29, 2024
1 parent b107fc2 commit d94a367
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions spec/requests/api/v2/media_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,22 @@
end
end

context 'when media description is too long' do
let(:params) do
{
file: fixture_file_upload('attachment-jpg.123456_abcd', 'image/jpeg'),
description: 'aa' * MediaAttachment::MAX_DESCRIPTION_LENGTH,
}
end

it 'returns http error' do
post '/api/v2/media', headers: headers, params: params

expect(response).to have_http_status(422)
expect(response.body).to include 'Description is too long'
end
end

context 'when large format media attachment has not been processed' do
let(:params) { { file: fixture_file_upload('attachment.webm', 'video/webm') } }

Expand Down

0 comments on commit d94a367

Please sign in to comment.