diff options
Diffstat (limited to 'spec/lib/banzai/filter/relative_link_filter_spec.rb')
-rw-r--r-- | spec/lib/banzai/filter/relative_link_filter_spec.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/spec/lib/banzai/filter/relative_link_filter_spec.rb b/spec/lib/banzai/filter/relative_link_filter_spec.rb index f983265ce71..046c346a7ac 100644 --- a/spec/lib/banzai/filter/relative_link_filter_spec.rb +++ b/spec/lib/banzai/filter/relative_link_filter_spec.rb @@ -29,6 +29,10 @@ describe Banzai::Filter::RelativeLinkFilter do %(<video src="#{path}"></video>) end + def audio(path) + %(<audio src="#{path}"></audio>) + end + def link(path) %(<a href="#{path}">#{path}</a>) end @@ -82,6 +86,12 @@ describe Banzai::Filter::RelativeLinkFilter do expect(doc.at_css('video')['src']).to eq 'files/videos/intro.mp4' end + + it 'does not modify any relative URL in audio' do + doc = filter(audio('files/audio/sample.wav'), commit: project.commit('audio'), ref: 'audio') + + expect(doc.at_css('audio')['src']).to eq 'files/audio/sample.wav' + end end context 'with a project_wiki' do @@ -218,6 +228,13 @@ describe Banzai::Filter::RelativeLinkFilter do .to eq "/#{project_path}/raw/video/files/videos/intro.mp4" end + it 'rebuilds relative URL for audio in the repo' do + doc = filter(audio('files/audio/sample.wav'), commit: project.commit('audio'), ref: 'audio') + + expect(doc.at_css('audio')['src']) + .to eq "/#{project_path}/raw/audio/files/audio/sample.wav" + end + it 'does not modify relative URL with an anchor only' do doc = filter(link('#section-1')) expect(doc.at_css('a')['href']).to eq '#section-1' |