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
b48d8c8a
Commit
b48d8c8a
authored
Jan 30, 2018
by
Matija Čupić
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Return all variables after UPDATE
parent
9eb3bb5c
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
2 deletions
+36
-2
app/controllers/groups/variables_controller.rb
app/controllers/groups/variables_controller.rb
+6
-1
app/controllers/projects/variables_controller.rb
app/controllers/projects/variables_controller.rb
+6
-1
spec/controllers/groups/variables_controller_spec.rb
spec/controllers/groups/variables_controller_spec.rb
+12
-0
spec/controllers/projects/variables_controller_spec.rb
spec/controllers/projects/variables_controller_spec.rb
+12
-0
No files found.
app/controllers/groups/variables_controller.rb
View file @
b48d8c8a
...
@@ -16,7 +16,12 @@ module Groups
...
@@ -16,7 +16,12 @@ module Groups
def
update
def
update
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
json
do
format
.
json
do
return
head
:ok
if
@group
.
update
(
variables_params
)
if
@group
.
update
(
variables_params
)
variables
=
@group
.
variables
.
map
{
|
variable
|
variable
.
present
(
current_user:
current_user
)
}
return
render
status: :ok
,
json:
{
variables:
variables
}
end
render
status: :bad_request
,
json:
@group
.
errors
.
full_messages
render
status: :bad_request
,
json:
@group
.
errors
.
full_messages
end
end
...
...
app/controllers/projects/variables_controller.rb
View file @
b48d8c8a
...
@@ -15,7 +15,12 @@ class Projects::VariablesController < Projects::ApplicationController
...
@@ -15,7 +15,12 @@ class Projects::VariablesController < Projects::ApplicationController
def
update
def
update
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
json
do
format
.
json
do
return
head
:ok
if
@project
.
update
(
variables_params
)
if
@project
.
update
(
variables_params
)
variables
=
@project
.
variables
.
map
{
|
variable
|
variable
.
present
(
current_user:
current_user
)
}
return
render
status: :ok
,
json:
{
variables:
variables
}
end
render
status: :bad_request
,
json:
@project
.
errors
.
full_messages
render
status: :bad_request
,
json:
@project
.
errors
.
full_messages
end
end
...
...
spec/controllers/groups/variables_controller_spec.rb
View file @
b48d8c8a
...
@@ -78,6 +78,12 @@ describe Groups::VariablesController do
...
@@ -78,6 +78,12 @@ describe Groups::VariablesController do
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
end
it
'has all variables in response'
do
subject
expect
(
response
.
body
).
to
include
(
group
.
variables
.
reload
.
to_json
)
end
end
end
context
'with a deleted variable'
do
context
'with a deleted variable'
do
...
@@ -101,6 +107,12 @@ describe Groups::VariablesController do
...
@@ -101,6 +107,12 @@ describe Groups::VariablesController do
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
end
it
'has all variables in response'
do
subject
expect
(
response
.
body
).
to
include
(
group
.
variables
.
reload
.
to_json
)
end
end
end
end
end
end
end
spec/controllers/projects/variables_controller_spec.rb
View file @
b48d8c8a
...
@@ -87,6 +87,12 @@ describe Projects::VariablesController do
...
@@ -87,6 +87,12 @@ describe Projects::VariablesController do
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
end
it
'has all variables in response'
do
subject
expect
(
response
.
body
).
to
include
(
project
.
variables
.
reload
.
to_json
)
end
end
end
context
'with a deleted variable'
do
context
'with a deleted variable'
do
...
@@ -110,6 +116,12 @@ describe Projects::VariablesController do
...
@@ -110,6 +116,12 @@ describe Projects::VariablesController do
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
end
it
'has all variables in response'
do
subject
expect
(
response
.
body
).
to
include
(
project
.
variables
.
reload
.
to_json
)
end
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