summaryrefslogtreecommitdiff
path: root/spec/lib/banzai/filter/upload_link_filter_spec.rb
diff options
context:
space:
mode:
authorFilipa Lacerda <filipa@gitlab.com>2017-08-07 11:09:50 +0100
committerFilipa Lacerda <filipa@gitlab.com>2017-08-07 11:09:50 +0100
commit3b9012871da7dbf6d4f5463654c7c478012e694e (patch)
tree0dfd072107d486a85de73b3ae4016d4f4d13d04a /spec/lib/banzai/filter/upload_link_filter_spec.rb
parent25c9b5b531c5dfe08f9dc9d075589a30465fa318 (diff)
parent03b816f3e845c9b25d3588336fc1616238465deb (diff)
downloadgitlab-ce-3b9012871da7dbf6d4f5463654c7c478012e694e.tar.gz
Merge branch 'master' into zj-project-templates
* master: (623 commits) Fix issues with pdf-js dependencies fix missing changelog entries for security release on 2017-01-23 Update top bar issues icon Fix pipeline icon in contextual nav for projects Since mysql is not a priority anymore, test it less Fix order of CI lint ace editor loading Add container registry and spam logs icons Fix different Markdown styles Backport to CE for: Make new dropdown dividers full width Fix spec Fix spec Fix spec Bump GITLAB_SHELL_VERSION and GITALY_VERSION to support unhiding refs Add changelog Install yarn via apt in update guides Use long curl options fix Add a spec for concurrent process Remove monkey-patched Array.prototype.first() and last() methods ...
Diffstat (limited to 'spec/lib/banzai/filter/upload_link_filter_spec.rb')
-rw-r--r--spec/lib/banzai/filter/upload_link_filter_spec.rb14
1 files changed, 7 insertions, 7 deletions
diff --git a/spec/lib/banzai/filter/upload_link_filter_spec.rb b/spec/lib/banzai/filter/upload_link_filter_spec.rb
index 6327ca8bbfd..60a88e903ef 100644
--- a/spec/lib/banzai/filter/upload_link_filter_spec.rb
+++ b/spec/lib/banzai/filter/upload_link_filter_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'
-describe Banzai::Filter::UploadLinkFilter, lib: true do
+describe Banzai::Filter::UploadLinkFilter do
def filter(doc, contexts = {})
contexts.reverse_merge!({
project: project
@@ -29,7 +29,7 @@ describe Banzai::Filter::UploadLinkFilter, lib: true do
%(<div><a href="#{path}">#{path}</a></div>)
end
- let(:project) { create(:empty_project) }
+ let(:project) { create(:project) }
shared_examples :preserve_unchanged do
it 'does not modify any relative URL in anchor' do
@@ -52,21 +52,21 @@ describe Banzai::Filter::UploadLinkFilter, lib: true do
it 'rebuilds relative URL for a link' do
doc = filter(link('/uploads/e90decf88d8f96fe9e1389afc2e4a91f/test.jpg'))
expect(doc.at_css('a')['href'])
- .to eq "#{Gitlab.config.gitlab.url}/#{project.path_with_namespace}/uploads/e90decf88d8f96fe9e1389afc2e4a91f/test.jpg"
+ .to eq "#{Gitlab.config.gitlab.url}/#{project.full_path}/uploads/e90decf88d8f96fe9e1389afc2e4a91f/test.jpg"
doc = filter(nested_link('/uploads/e90decf88d8f96fe9e1389afc2e4a91f/test.jpg'))
expect(doc.at_css('a')['href'])
- .to eq "#{Gitlab.config.gitlab.url}/#{project.path_with_namespace}/uploads/e90decf88d8f96fe9e1389afc2e4a91f/test.jpg"
+ .to eq "#{Gitlab.config.gitlab.url}/#{project.full_path}/uploads/e90decf88d8f96fe9e1389afc2e4a91f/test.jpg"
end
it 'rebuilds relative URL for an image' do
doc = filter(image('/uploads/e90decf88d8f96fe9e1389afc2e4a91f/test.jpg'))
expect(doc.at_css('img')['src'])
- .to eq "#{Gitlab.config.gitlab.url}/#{project.path_with_namespace}/uploads/e90decf88d8f96fe9e1389afc2e4a91f/test.jpg"
+ .to eq "#{Gitlab.config.gitlab.url}/#{project.full_path}/uploads/e90decf88d8f96fe9e1389afc2e4a91f/test.jpg"
doc = filter(nested_image('/uploads/e90decf88d8f96fe9e1389afc2e4a91f/test.jpg'))
expect(doc.at_css('img')['src'])
- .to eq "#{Gitlab.config.gitlab.url}/#{project.path_with_namespace}/uploads/e90decf88d8f96fe9e1389afc2e4a91f/test.jpg"
+ .to eq "#{Gitlab.config.gitlab.url}/#{project.full_path}/uploads/e90decf88d8f96fe9e1389afc2e4a91f/test.jpg"
end
it 'does not modify absolute URL' do
@@ -85,7 +85,7 @@ describe Banzai::Filter::UploadLinkFilter, lib: true do
.to receive(:image?).with(path).and_return(true)
doc = filter(image(escaped))
- expect(doc.at_css('img')['src']).to match "#{Gitlab.config.gitlab.url}/#{project.path_with_namespace}/uploads/%ED%95%9C%EA%B8%80.png"
+ expect(doc.at_css('img')['src']).to match "#{Gitlab.config.gitlab.url}/#{project.full_path}/uploads/%ED%95%9C%EA%B8%80.png"
end
end