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
070792a7
Commit
070792a7
authored
Jun 04, 2017
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add spec for Geo routing improvements
parent
9fcb63db
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
2 deletions
+44
-2
app/helpers/ee/gitlab_routing_helper.rb
app/helpers/ee/gitlab_routing_helper.rb
+5
-2
spec/helpers/ee/gitlab_routing_helper_spec.rb
spec/helpers/ee/gitlab_routing_helper_spec.rb
+39
-0
No files found.
app/helpers/ee/gitlab_routing_helper.rb
View file @
070792a7
module
EE
module
GitlabRoutingHelper
include
ProjectsHelper
include
ApplicationSettingsHelper
def
geo_primary_web_url
(
project
)
File
.
join
(
::
Gitlab
::
Geo
.
primary_node
.
url
,
::
Gitlab
::
Routing
.
url_helpers
.
namespace_project_path
(
project
.
namespace
,
project
))
end
...
...
@@ -14,10 +17,10 @@ module EE
def
geo_primary_default_url_to_repo
(
project
)
case
default_clone_protocol
when
'http'
geo_primary_http_url_to_repo
(
project
)
when
'ssh'
geo_primary_ssh_url_to_repo
(
project
)
else
geo_primary_http_url_to_repo
(
project
)
end
end
end
...
...
spec/helpers/ee/gitlab_routing_helper_spec.rb
0 → 100644
View file @
070792a7
require
'spec_helper'
describe
EE
::
GitlabRoutingHelper
do
include
ProjectsHelper
include
ApplicationSettingsHelper
let!
(
:primary_node
)
{
create
(
:geo_node
,
:primary
)
}
let
(
:project
)
{
build_stubbed
(
:empty_project
)
}
describe
'#geo_primary_default_url_to_repo'
do
it
'returns an HTTP URL'
do
allow
(
helper
).
to
receive
(
:default_clone_protocol
).
and_return
(
'http'
)
result
=
helper
.
geo_primary_default_url_to_repo
(
project
)
expect
(
result
).
to
start_with
(
'http://'
)
expect
(
result
).
to
eq
(
helper
.
geo_primary_http_url_to_repo
(
project
))
end
it
'returns an HTTPS URL'
do
primary_node
.
update_attribute
(
:schema
,
'https'
)
allow
(
helper
).
to
receive
(
:default_clone_protocol
).
and_return
(
'https'
)
result
=
helper
.
geo_primary_default_url_to_repo
(
project
)
expect
(
result
).
to
start_with
(
'https://'
)
expect
(
result
).
to
eq
(
helper
.
geo_primary_http_url_to_repo
(
project
))
end
it
'returns an SSH URL'
do
allow
(
helper
).
to
receive
(
:default_clone_protocol
).
and_return
(
'ssh'
)
result
=
helper
.
geo_primary_default_url_to_repo
(
project
)
expect
(
result
).
to
start_with
(
'git@'
)
expect
(
result
).
to
eq
(
helper
.
geo_primary_ssh_url_to_repo
(
project
))
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