Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
ef79cf7a
Commit
ef79cf7a
authored
Mar 25, 2016
by
Gabriel Mazetto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
specs for Geo patch to Banzai
parent
609c018e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
0 deletions
+26
-0
spec/lib/banzai/filter/upload_link_filter_spec.rb
spec/lib/banzai/filter/upload_link_filter_spec.rb
+26
-0
No files found.
spec/lib/banzai/filter/upload_link_filter_spec.rb
View file @
ef79cf7a
...
...
@@ -69,5 +69,31 @@ describe Banzai::Filter::UploadLinkFilter, lib: true do
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"
end
context
'in a geo secondary node'
do
let
(
:geo_url
)
{
'http://geo.example.com'
}
before
(
:each
)
do
allow
(
Gitlab
::
Geo
).
to
receive
(
:secondary?
)
{
true
}
allow
(
Gitlab
::
Geo
).
to
receive_message_chain
(
:primary_node
,
:url
)
{
geo_url
}
end
it
'rebuilds relative URL for a link'
do
doc
=
filter
(
link
(
'/uploads/e90decf88d8f96fe9e1389afc2e4a91f/test.jpg'
))
expect
(
doc
.
at_css
(
'a'
)[
'href'
]).
to
eq
"
#{
geo_url
}
/
#{
project
.
path_with_namespace
}
/uploads/e90decf88d8f96fe9e1389afc2e4a91f/test.jpg"
end
it
'rebuilds relative URL for an image'
do
doc
=
filter
(
link
(
'/uploads/e90decf88d8f96fe9e1389afc2e4a91f/test.jpg'
))
expect
(
doc
.
at_css
(
'a'
)[
'href'
]).
to
eq
"
#{
geo_url
}
/
#{
project
.
path_with_namespace
}
/uploads/e90decf88d8f96fe9e1389afc2e4a91f/test.jpg"
end
it
'does not modify absolute URL'
do
doc
=
filter
(
link
(
'http://example.com'
))
expect
(
doc
.
at_css
(
'a'
)[
'href'
]).
to
eq
'http://example.com'
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment