diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-18 14:18:50 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-18 14:18:50 +0300 |
commit | 8c7f4e9d5f36cff46365a7f8c4b9c21578c1e781 (patch) | |
tree | a77e7fe7a93de11213032ed4ab1f33a3db51b738 /spec/lib/banzai/filter/wiki_link_filter_spec.rb | |
parent | 00b35af3db1abfe813a778f643dad221aad51fca (diff) |
Add latest changes from gitlab-org/gitlab@13-1-stable-ee
Diffstat (limited to 'spec/lib/banzai/filter/wiki_link_filter_spec.rb')
-rw-r--r-- | spec/lib/banzai/filter/wiki_link_filter_spec.rb | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/spec/lib/banzai/filter/wiki_link_filter_spec.rb b/spec/lib/banzai/filter/wiki_link_filter_spec.rb index 4587bd85939..827f38ef717 100644 --- a/spec/lib/banzai/filter/wiki_link_filter_spec.rb +++ b/spec/lib/banzai/filter/wiki_link_filter_spec.rb @@ -12,13 +12,13 @@ describe Banzai::Filter::WikiLinkFilter do let(:repository_upload_folder) { Wikis::CreateAttachmentService::ATTACHMENT_PATH } it "doesn't rewrite absolute links" do - filtered_link = filter("<a href='http://example.com:8000/'>Link</a>", project_wiki: wiki).children[0] + filtered_link = filter("<a href='http://example.com:8000/'>Link</a>", wiki: wiki).children[0] expect(filtered_link.attribute('href').value).to eq('http://example.com:8000/') end it "doesn't rewrite links to project uploads" do - filtered_link = filter("<a href='/uploads/a.test'>Link</a>", project_wiki: wiki).children[0] + filtered_link = filter("<a href='/uploads/a.test'>Link</a>", wiki: wiki).children[0] expect(filtered_link.attribute('href').value).to eq('/uploads/a.test') end @@ -26,7 +26,7 @@ describe Banzai::Filter::WikiLinkFilter do describe "when links point to the #{Wikis::CreateAttachmentService::ATTACHMENT_PATH} folder" do context 'with an "a" html tag' do it 'rewrites links' do - filtered_link = filter("<a href='#{repository_upload_folder}/a.test'>Link</a>", project_wiki: wiki).children[0] + filtered_link = filter("<a href='#{repository_upload_folder}/a.test'>Link</a>", wiki: wiki).children[0] expect(filtered_link.attribute('href').value).to eq("#{wiki.wiki_base_path}/#{repository_upload_folder}/a.test") end @@ -37,7 +37,7 @@ describe Banzai::Filter::WikiLinkFilter do context 'inside an "a" html tag' do it 'rewrites links' do - filtered_elements = filter("<a href='#{repository_upload_folder}/a.jpg'><img src='#{repository_upload_folder}/a.jpg'>example</img></a>", project_wiki: wiki) + filtered_elements = filter("<a href='#{repository_upload_folder}/a.jpg'><img src='#{repository_upload_folder}/a.jpg'>example</img></a>", wiki: wiki) expect(filtered_elements.search('img').first.attribute('src').value).to eq(path) expect(filtered_elements.search('a').first.attribute('href').value).to eq(path) @@ -46,7 +46,7 @@ describe Banzai::Filter::WikiLinkFilter do context 'outside an "a" html tag' do it 'rewrites links' do - filtered_link = filter("<img src='#{repository_upload_folder}/a.jpg'>example</img>", project_wiki: wiki).children[0] + filtered_link = filter("<img src='#{repository_upload_folder}/a.jpg'>example</img>", wiki: wiki).children[0] expect(filtered_link.attribute('src').value).to eq(path) end @@ -55,7 +55,7 @@ describe Banzai::Filter::WikiLinkFilter do context 'with "video" html tag' do it 'rewrites links' do - filtered_link = filter("<video src='#{repository_upload_folder}/a.mp4'></video>", project_wiki: wiki).children[0] + filtered_link = filter("<video src='#{repository_upload_folder}/a.mp4'></video>", wiki: wiki).children[0] expect(filtered_link.attribute('src').value).to eq("#{wiki.wiki_base_path}/#{repository_upload_folder}/a.mp4") end @@ -63,7 +63,7 @@ describe Banzai::Filter::WikiLinkFilter do context 'with "audio" html tag' do it 'rewrites links' do - filtered_link = filter("<audio src='#{repository_upload_folder}/a.wav'></audio>", project_wiki: wiki).children[0] + filtered_link = filter("<audio src='#{repository_upload_folder}/a.wav'></audio>", wiki: wiki).children[0] expect(filtered_link.attribute('src').value).to eq("#{wiki.wiki_base_path}/#{repository_upload_folder}/a.wav") end @@ -75,7 +75,7 @@ describe Banzai::Filter::WikiLinkFilter do invalid_links.each do |invalid_link| it "doesn't rewrite invalid invalid_links like #{invalid_link}" do - filtered_link = filter("<a href='#{invalid_link}'>Link</a>", project_wiki: wiki).children[0] + filtered_link = filter("<a href='#{invalid_link}'>Link</a>", wiki: wiki).children[0] expect(filtered_link.attribute('href').value).to eq(invalid_link) end |