summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Jankowski <matt@jankowski.online>2024-04-04 12:07:16 -0400
committerGitHub <noreply@github.com>2024-04-04 16:07:16 +0000
commit191bf5876e73e586a04e642bc9b63e42721d30ad (patch)
tree0910da73a52b94e12ceba7883cec4443f8c3b940
parent1c87cb8019bafd2eb5b126ed0e9186ce20e94b1e (diff)
Add coverage for sanitize failure path in api/web/embeds spec (#29851)
-rw-r--r--spec/requests/api/web/embeds_spec.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/requests/api/web/embeds_spec.rb b/spec/requests/api/web/embeds_spec.rb
index 6314f43aafe..0e6195204bc 100644
--- a/spec/requests/api/web/embeds_spec.rb
+++ b/spec/requests/api/web/embeds_spec.rb
@@ -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 }