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
8707827d
Commit
8707827d
authored
Jan 04, 2019
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve readablity of CI_API_V4_URL related code
parent
476cba6f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
3 additions
and
5 deletions
+3
-5
app/models/project.rb
app/models/project.rb
+1
-3
lib/api/helpers/version.rb
lib/api/helpers/version.rb
+1
-1
spec/lib/api/helpers/version_spec.rb
spec/lib/api/helpers/version_spec.rb
+1
-1
No files found.
app/models/project.rb
View file @
8707827d
...
@@ -1705,9 +1705,7 @@ class Project < ActiveRecord::Base
...
@@ -1705,9 +1705,7 @@ class Project < ActiveRecord::Base
def
api_variables
def
api_variables
Gitlab
::
Ci
::
Variables
::
Collection
.
new
.
tap
do
|
variables
|
Gitlab
::
Ci
::
Variables
::
Collection
.
new
.
tap
do
|
variables
|
API
::
Helpers
::
Version
.
new
(
'v4'
).
tap
do
|
version
|
variables
.
append
(
key:
'CI_API_V4_URL'
,
value:
API
::
Helpers
::
Version
.
new
(
'v4'
).
root_url
)
variables
.
append
(
key:
'CI_API_V4_URL'
,
value:
version
.
root_url
)
end
end
end
end
end
...
...
lib/api/helpers/version.rb
View file @
8707827d
...
@@ -18,7 +18,7 @@ module API
...
@@ -18,7 +18,7 @@ module API
end
end
def
root_url
def
root_url
@root_url
||=
expose_url
(
root_path
)
@root_url
||=
expose_url
(
root_path
)
end
end
def
to_s
def
to_s
...
...
spec/lib/api/helpers/version_spec.rb
View file @
8707827d
...
@@ -20,7 +20,7 @@ describe API::Helpers::Version do
...
@@ -20,7 +20,7 @@ describe API::Helpers::Version do
describe
'#root_url'
do
describe
'#root_url'
do
it
'returns an URL for a root path for the API version'
do
it
'returns an URL for a root path for the API version'
do
expect
(
described_class
.
new
(
'v4'
).
root_url
)
expect
(
described_class
.
new
(
'v4'
).
root_url
)
.
to
match
%r{^http?://.*/api/v4$}
.
to
eq
'http://localhost/api/v4'
end
end
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