diff options
author | Robert Speicher <robert@gitlab.com> | 2016-05-10 20:07:10 +0300 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2016-05-10 20:07:10 +0300 |
commit | 0cc8cee6cd58cfa8e34eccccb14fb146630f9cb7 (patch) | |
tree | e71ae516a07721127dc7955e339d54d589cffbca /spec/lib | |
parent | 98d8e3fe9ff4d120469378490c41381ae751597e (diff) | |
parent | 535be93a77ec677dbb561f8c1545a60d0d908832 (diff) |
Merge branch 'fix/using-uploads-in-global-snippets' into 'master'
Fix using link to uploads in global snippets
Closes #17342, closes #17363
See merge request !4085
Diffstat (limited to 'spec/lib')
-rw-r--r-- | spec/lib/banzai/filter/upload_link_filter_spec.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/lib/banzai/filter/upload_link_filter_spec.rb b/spec/lib/banzai/filter/upload_link_filter_spec.rb index 3b073a90a95..b83be54746c 100644 --- a/spec/lib/banzai/filter/upload_link_filter_spec.rb +++ b/spec/lib/banzai/filter/upload_link_filter_spec.rb @@ -8,6 +8,10 @@ describe Banzai::Filter::UploadLinkFilter, lib: true do project: project }) + raw_filter(doc, contexts) + end + + def raw_filter(doc, contexts = {}) described_class.call(doc, contexts) end @@ -70,4 +74,18 @@ describe Banzai::Filter::UploadLinkFilter, lib: true do expect(doc.at_css('img')['src']).to match "#{Gitlab.config.gitlab.url}/#{project.path_with_namespace}/uploads/%ED%95%9C%EA%B8%80.png" end end + + context 'when project context does not exist' do + let(:upload_link) { link('/uploads/e90decf88d8f96fe9e1389afc2e4a91f/test.jpg') } + + it 'does not raise error' do + expect { raw_filter(upload_link, project: nil) }.not_to raise_error + end + + it 'does not rewrite link' do + doc = raw_filter(upload_link, project: nil) + + expect(doc.to_html).to eq upload_link + end + end end |