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

Use heredoc on the HTML blocks in verify link spec (#29365)

This commit is contained in:
Matt Jankowski 2024-02-22 16:26:48 -05:00 committed by GitHub
parent 9d8dfeb5fb
commit a6ed148769
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -77,11 +77,11 @@ RSpec.describe VerifyLinkService, type: :service do
context 'when a document is truncated but the link back is valid' do context 'when a document is truncated but the link back is valid' do
let(:html) do let(:html) do
" <<-HTML
<!doctype html> <!doctype html>
<body> <body>
<a rel=\"me\" href=\"#{ActivityPub::TagManager.instance.url_for(account)}\"> <a rel="me" href="#{ActivityPub::TagManager.instance.url_for(account)}">
" HTML
end end
it 'marks the field as verified' do it 'marks the field as verified' do
@ -91,11 +91,11 @@ RSpec.describe VerifyLinkService, type: :service do
context 'when a link tag might be truncated' do context 'when a link tag might be truncated' do
let(:html) do let(:html) do
" <<-HTML_TRUNCATED
<!doctype html> <!doctype html>
<body> <body>
<a rel=\"me\" href=\"#{ActivityPub::TagManager.instance.url_for(account)}\" <a rel="me" href="#{ActivityPub::TagManager.instance.url_for(account)}"
" HTML_TRUNCATED
end end
it 'marks the field as not verified' do it 'marks the field as not verified' do
@ -166,7 +166,11 @@ RSpec.describe VerifyLinkService, type: :service do
# #
# apparently github allows the user to enter website URLs with a single # apparently github allows the user to enter website URLs with a single
# slash and makes no attempts to correct that. # slash and makes no attempts to correct that.
let(:html) { '<a href="http:/unrelated.example">Hello</a>' } let(:html) do
<<-HTML
<a href="http:/unrelated.example">Hello</a>
HTML
end
it 'does not crash' do it 'does not crash' do
# We could probably put more effort into perhaps auto-correcting the # We could probably put more effort into perhaps auto-correcting the