diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-01 00:06:28 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-01 00:06:28 +0300 |
commit | 8f210aebe1d740e8ee194f171f1f33a6e1fba313 (patch) | |
tree | f43c545801bb96fd0737f18493fb30ab92972627 /spec/lib/banzai/filter/wiki_link_filter_spec.rb | |
parent | 996f700997805b3590da8d8afdd19d193989078a (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/banzai/filter/wiki_link_filter_spec.rb')
-rw-r--r-- | spec/lib/banzai/filter/wiki_link_filter_spec.rb | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/spec/lib/banzai/filter/wiki_link_filter_spec.rb b/spec/lib/banzai/filter/wiki_link_filter_spec.rb index 7a83dc3ec1d..4587bd85939 100644 --- a/spec/lib/banzai/filter/wiki_link_filter_spec.rb +++ b/spec/lib/banzai/filter/wiki_link_filter_spec.rb @@ -11,10 +11,6 @@ describe Banzai::Filter::WikiLinkFilter do let(:wiki) { ProjectWiki.new(project, user) } let(:repository_upload_folder) { Wikis::CreateAttachmentService::ATTACHMENT_PATH } - def upload_href(file_name) - ::File.join(wiki.wiki_page_path, repository_upload_folder, file_name) - end - it "doesn't rewrite absolute links" do filtered_link = filter("<a href='http://example.com:8000/'>Link</a>", project_wiki: wiki).children[0] @@ -32,12 +28,12 @@ describe Banzai::Filter::WikiLinkFilter do it 'rewrites links' do filtered_link = filter("<a href='#{repository_upload_folder}/a.test'>Link</a>", project_wiki: wiki).children[0] - expect(filtered_link.attribute('href').value).to eq(upload_href "a.test") + expect(filtered_link.attribute('href').value).to eq("#{wiki.wiki_base_path}/#{repository_upload_folder}/a.test") end end context 'with "img" html tag' do - let(:path) { upload_href "a.jpg" } + let(:path) { "#{wiki.wiki_base_path}/#{repository_upload_folder}/a.jpg" } context 'inside an "a" html tag' do it 'rewrites links' do @@ -61,7 +57,7 @@ describe Banzai::Filter::WikiLinkFilter do it 'rewrites links' do filtered_link = filter("<video src='#{repository_upload_folder}/a.mp4'></video>", project_wiki: wiki).children[0] - expect(filtered_link.attribute('src').value).to eq(upload_href "a.mp4") + expect(filtered_link.attribute('src').value).to eq("#{wiki.wiki_base_path}/#{repository_upload_folder}/a.mp4") end end @@ -69,8 +65,7 @@ describe Banzai::Filter::WikiLinkFilter do it 'rewrites links' do filtered_link = filter("<audio src='#{repository_upload_folder}/a.wav'></audio>", project_wiki: wiki).children[0] - # expect(filtered_link.attribute('src').value).to eq("#{wiki.wiki_base_path}/#{repository_upload_folder}/a.wav") - expect(filtered_link.attribute('src').value).to eq(upload_href "a.wav") + expect(filtered_link.attribute('src').value).to eq("#{wiki.wiki_base_path}/#{repository_upload_folder}/a.wav") end end end |