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
1819dbd4
Commit
1819dbd4
authored
Aug 26, 2019
by
Robert Schilling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Incorporate review feedback
parent
0ec6134f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
9 deletions
+9
-9
spec/requests/api/labels_spec.rb
spec/requests/api/labels_spec.rb
+9
-9
No files found.
spec/requests/api/labels_spec.rb
View file @
1819dbd4
...
...
@@ -475,15 +475,14 @@ describe API::Labels do
describe
'PUT /projects/:id/labels/promote'
do
let
(
:group
)
{
create
(
:group
)
}
let!
(
:project1
)
{
create
(
:project
,
namespace:
group
)
}
let!
(
:label1
)
{
create
(
:label
,
title:
'label1'
,
project:
project1
)
}
before
do
group
.
add_owner
(
user
)
project
.
update!
(
group:
group
)
end
it
'returns 200 if label is promoted'
do
put
api
(
"/projects/
#{
project
1
.
id
}
/labels/promote"
,
user
),
params:
{
name:
label1
.
name
}
put
api
(
"/projects/
#{
project
.
id
}
/labels/promote"
,
user
),
params:
{
name:
label1
.
name
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
json_response
[
'name'
]).
to
eq
(
label1
.
name
)
...
...
@@ -493,29 +492,30 @@ describe API::Labels do
it
'returns 200 if group label already exists'
do
create
(
:group_label
,
title:
label1
.
name
,
group:
group
)
put
api
(
"/projects/
#{
project1
.
id
}
/labels/promote"
,
user
),
params:
{
name:
label1
.
name
}
expect
{
put
api
(
"/projects/
#{
project
.
id
}
/labels/promote"
,
user
),
params:
{
name:
label1
.
name
}
}
.
to
change
(
project
.
labels
,
:count
).
by
(
-
1
)
.
and
change
(
group
.
labels
,
:count
).
by
(
0
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
project1
.
labels
.
size
).
to
eq
(
0
)
end
it
'returns 403 if guest promotes label'
do
guest
=
create
(
:user
)
project
1
.
add_guest
(
guest
)
project
.
add_guest
(
guest
)
put
api
(
"/projects/
#{
project
1
.
id
}
/labels/promote"
,
guest
),
params:
{
name:
label1
.
name
}
put
api
(
"/projects/
#{
project
.
id
}
/labels/promote"
,
guest
),
params:
{
name:
label1
.
name
}
expect
(
response
).
to
have_gitlab_http_status
(
403
)
end
it
'returns 404 if label does not exist'
do
put
api
(
"/projects/
#{
project
1
.
id
}
/labels/promote"
,
user
),
params:
{
name:
'unknown'
}
put
api
(
"/projects/
#{
project
.
id
}
/labels/promote"
,
user
),
params:
{
name:
'unknown'
}
expect
(
response
).
to
have_gitlab_http_status
(
404
)
end
it
'returns 400 if no label name given'
do
put
api
(
"/projects/
#{
project
1
.
id
}
/labels/promote"
,
user
)
put
api
(
"/projects/
#{
project
.
id
}
/labels/promote"
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
400
)
expect
(
json_response
[
'error'
]).
to
eq
(
'name is missing'
)
...
...
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