BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
efc5fbfd
Commit
efc5fbfd
authored
Jun 27, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '34282-fix-api-using-include_missing-false' into 'master'
Fix optional arugments for POST :id/variables Closes #34282 See merge request !12474
parents
018f7e46
f8de6d65
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
1 deletion
+16
-1
34282-fix-api-using-include_missing-false.yml
.../unreleased/34282-fix-api-using-include_missing-false.yml
+4
-0
variables.rb
lib/api/variables.rb
+1
-1
variables_spec.rb
spec/requests/api/variables_spec.rb
+11
-0
No files found.
changelogs/unreleased/34282-fix-api-using-include_missing-false.yml
0 → 100644
View file @
efc5fbfd
---
title
:
'
API:
Fix
optional
arugments
for
POST
:id/variables'
merge_request
:
12474
author
:
lib/api/variables.rb
View file @
efc5fbfd
...
...
@@ -45,7 +45,7 @@ module API
optional
:protected
,
type:
String
,
desc:
'Whether the variable is protected'
end
post
':id/variables'
do
variable
=
user_project
.
variables
.
create
(
declared
(
params
,
include_parent_namespaces:
false
).
to_h
)
variable
=
user_project
.
variables
.
create
(
declared
_params
(
include_missing:
false
)
)
if
variable
.
valid?
present
variable
,
with:
Entities
::
Variable
...
...
spec/requests/api/variables_spec.rb
View file @
efc5fbfd
...
...
@@ -82,6 +82,17 @@ describe API::Variables do
expect
(
json_response
[
'protected'
]).
to
be_truthy
end
it
'creates variable with optional attributes'
do
expect
do
post
api
(
"/projects/
#{
project
.
id
}
/variables"
,
user
),
key:
'TEST_VARIABLE_2'
,
value:
'VALUE_2'
end
.
to
change
{
project
.
variables
.
count
}.
by
(
1
)
expect
(
response
).
to
have_http_status
(
201
)
expect
(
json_response
[
'key'
]).
to
eq
(
'TEST_VARIABLE_2'
)
expect
(
json_response
[
'value'
]).
to
eq
(
'VALUE_2'
)
expect
(
json_response
[
'protected'
]).
to
be_falsey
end
it
'does not allow to duplicate variable key'
do
expect
do
post
api
(
"/projects/
#{
project
.
id
}
/variables"
,
user
),
key:
variable
.
key
,
value:
'VALUE_2'
...
...
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