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
1 changed files with 11 additions and 7 deletions

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