1
0
Fork 0
mirror of https://github.com/mastodon/mastodon.git synced 2024-08-20 21:08:15 -07:00

Add coverage for sanitize failure path in api/web/embeds spec (#29851)

This commit is contained in:
Matt Jankowski 2024-04-04 12:07:16 -04:00 committed by GitHub
parent 1c87cb8019
commit 191bf5876e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -137,6 +137,18 @@ RSpec.describe '/api/web/embed' do
end
end
context 'when sanitizing the fragment fails' do
let(:call_result) { { html: 'ok' } }
before { allow(Sanitize).to receive(:fragment).and_raise(ArgumentError) }
it 'returns http not found' do
subject
expect(response).to have_http_status(404)
end
end
context 'when failing to fetch OEmbed' do
let(:call_result) { nil }