summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwinniehell <git@winniehell.de>2016-08-01 03:58:31 +0200
committerwinniehell <git@winniehell.de>2016-08-02 03:44:07 +0200
commit701e5ccbe6018129130ee70a78f213c406c93fcf (patch)
treeb2804969625b351985ee7d6791ad275d7da06511
parentc009f620173df2bcce43670c61dfaaa845719ebe (diff)
downloadgitlab-ce-701e5ccbe6018129130ee70a78f213c406c93fcf.tar.gz
Add failing tests for #19028
-rw-r--r--spec/lib/banzai/filter/relative_link_filter_spec.rb12
1 files changed, 12 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 9921171f2aa..224baca8030 100644
--- a/spec/lib/banzai/filter/relative_link_filter_spec.rb
+++ b/spec/lib/banzai/filter/relative_link_filter_spec.rb
@@ -78,12 +78,24 @@ describe Banzai::Filter::RelativeLinkFilter, lib: true do
end
context 'with a valid repository' do
+ it 'rebuilds absolute URL for a file in the repo' do
+ doc = filter(link('/doc/api/README.md'))
+ expect(doc.at_css('a')['href']).
+ to eq "/#{project_path}/blob/#{ref}/doc/api/README.md"
+ end
+
it 'rebuilds relative URL for a file in the repo' do
doc = filter(link('doc/api/README.md'))
expect(doc.at_css('a')['href']).
to eq "/#{project_path}/blob/#{ref}/doc/api/README.md"
end
+ it 'rebuilds relative URL for a file in the repo with leading ./' do
+ doc = filter(link('./doc/api/README.md'))
+ expect(doc.at_css('a')['href']).
+ to eq "/#{project_path}/blob/#{ref}/doc/api/README.md"
+ end
+
it 'rebuilds relative URL for a file in the repo up one directory' do
relative_link = link('../api/README.md')
doc = filter(relative_link, requested_path: 'doc/update/7.14-to-8.0.md')