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
3914af2f
Commit
3914af2f
authored
Sep 19, 2017
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use set in some API specs
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
6ab74da9
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
87 additions
and
81 deletions
+87
-81
spec/requests/api/access_requests_spec.rb
spec/requests/api/access_requests_spec.rb
+6
-6
spec/requests/api/award_emoji_spec.rb
spec/requests/api/award_emoji_spec.rb
+7
-7
spec/requests/api/boards_spec.rb
spec/requests/api/boards_spec.rb
+18
-15
spec/requests/api/branches_spec.rb
spec/requests/api/branches_spec.rb
+8
-4
spec/requests/api/broadcast_messages_spec.rb
spec/requests/api/broadcast_messages_spec.rb
+3
-8
spec/requests/api/v3/award_emoji_spec.rb
spec/requests/api/v3/award_emoji_spec.rb
+7
-7
spec/requests/api/v3/boards_spec.rb
spec/requests/api/v3/boards_spec.rb
+14
-11
spec/requests/api/v3/branches_spec.rb
spec/requests/api/v3/branches_spec.rb
+5
-5
spec/requests/api/v3/broadcast_messages_spec.rb
spec/requests/api/v3/broadcast_messages_spec.rb
+3
-3
spec/requests/api/v3/builds_spec.rb
spec/requests/api/v3/builds_spec.rb
+6
-6
spec/requests/api/v3/issues_spec.rb
spec/requests/api/v3/issues_spec.rb
+10
-9
No files found.
spec/requests/api/access_requests_spec.rb
View file @
3914af2f
require
'spec_helper'
describe
API
::
AccessRequests
do
l
et
(
:master
)
{
create
(
:user
)
}
l
et
(
:developer
)
{
create
(
:user
)
}
l
et
(
:access_requester
)
{
create
(
:user
)
}
l
et
(
:stranger
)
{
create
(
:user
)
}
s
et
(
:master
)
{
create
(
:user
)
}
s
et
(
:developer
)
{
create
(
:user
)
}
s
et
(
:access_requester
)
{
create
(
:user
)
}
s
et
(
:stranger
)
{
create
(
:user
)
}
l
et
(
:project
)
do
s
et
(
:project
)
do
create
(
:project
,
:public
,
:access_requestable
,
creator_id:
master
.
id
,
namespace:
master
.
namespace
)
do
|
project
|
project
.
team
<<
[
developer
,
:developer
]
project
.
team
<<
[
master
,
:master
]
...
...
@@ -14,7 +14,7 @@ describe API::AccessRequests do
end
end
l
et
(
:group
)
do
s
et
(
:group
)
do
create
(
:group
,
:public
,
:access_requestable
)
do
|
group
|
group
.
add_developer
(
developer
)
group
.
add_owner
(
master
)
...
...
spec/requests/api/award_emoji_spec.rb
View file @
3914af2f
require
'spec_helper'
describe
API
::
AwardEmoji
do
let
(
:user
)
{
create
(
:user
)
}
let!
(
:project
)
{
create
(
:project
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
let!
(
:award_emoji
)
{
create
(
:award_emoji
,
awardable:
issue
,
user:
user
)
}
let!
(
:merge_request
)
{
create
(
:merge_request
,
source_project:
project
,
target_project:
project
)
}
let!
(
:downvote
)
{
create
(
:award_emoji
,
:downvote
,
awardable:
merge_request
,
user:
user
)
}
let!
(
:note
)
{
create
(
:note
,
project:
project
,
noteable:
issue
)
}
set
(
:user
)
{
create
(
:user
)
}
set
(
:project
)
{
create
(
:project
)
}
set
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
set
(
:award_emoji
)
{
create
(
:award_emoji
,
awardable:
issue
,
user:
user
)
}
let!
(
:merge_request
)
{
create
(
:merge_request
,
source_project:
project
,
target_project:
project
)
}
let!
(
:downvote
)
{
create
(
:award_emoji
,
:downvote
,
awardable:
merge_request
,
user:
user
)
}
set
(
:note
)
{
create
(
:note
,
project:
project
,
noteable:
issue
)
}
before
do
project
.
team
<<
[
user
,
:master
]
...
...
spec/requests/api/boards_spec.rb
View file @
3914af2f
require
'spec_helper'
describe
API
::
Boards
do
l
et
(
:user
)
{
create
(
:user
)
}
l
et
(
:user2
)
{
create
(
:user
)
}
l
et
(
:non_member
)
{
create
(
:user
)
}
l
et
(
:guest
)
{
create
(
:user
)
}
l
et
(
:admin
)
{
create
(
:user
,
:admin
)
}
let!
(
:project
)
{
create
(
:project
,
:public
,
creator_id:
user
.
id
,
namespace:
user
.
namespace
)
}
let!
(
:dev_label
)
do
s
et
(
:user
)
{
create
(
:user
)
}
s
et
(
:user2
)
{
create
(
:user
)
}
s
et
(
:non_member
)
{
create
(
:user
)
}
s
et
(
:guest
)
{
create
(
:user
)
}
s
et
(
:admin
)
{
create
(
:user
,
:admin
)
}
set
(
:project
)
{
create
(
:project
,
:public
,
creator_id:
user
.
id
,
namespace:
user
.
namespace
)
}
set
(
:dev_label
)
do
create
(
:label
,
title:
'Development'
,
color:
'#FFAABB'
,
project:
project
)
end
let!
(
:test_label
)
do
set
(
:test_label
)
do
create
(
:label
,
title:
'Testing'
,
color:
'#FFAACC'
,
project:
project
)
end
let!
(
:ux_label
)
do
set
(
:ux_label
)
do
create
(
:label
,
title:
'UX'
,
color:
'#FF0000'
,
project:
project
)
end
let!
(
:dev_list
)
do
set
(
:dev_list
)
do
create
(
:list
,
label:
dev_label
,
position:
1
)
end
let!
(
:test_list
)
do
set
(
:test_list
)
do
create
(
:list
,
label:
test_label
,
position:
2
)
end
let!
(
:board
)
do
set
(
:board
)
do
create
(
:board
,
project:
project
,
lists:
[
dev_list
,
test_list
])
end
...
...
@@ -187,8 +187,11 @@ describe API::Boards do
end
context
"when the user is project owner"
do
let
(
:owner
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
,
namespace:
owner
.
namespace
)
}
set
(
:owner
)
{
create
(
:user
)
}
before
do
project
.
update
(
namespace:
owner
.
namespace
)
end
it
"deletes the list if an admin requests it"
do
delete
api
(
"
#{
base_url
}
/
#{
dev_list
.
id
}
"
,
owner
)
...
...
spec/requests/api/branches_spec.rb
View file @
3914af2f
require
'spec_helper'
describe
API
::
Branches
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:guest
)
{
create
(
:user
).
tap
{
|
u
|
project
.
add_guest
(
u
)
}
}
set
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
,
:repository
,
creator:
user
,
path:
'my.project'
)
}
let
(
:guest
)
{
create
(
:user
).
tap
{
|
u
|
project
.
add_guest
(
u
)
}
}
let
(
:branch_name
)
{
'feature'
}
let
(
:branch_sha
)
{
'0b4bc9a49b562e85de7cc9e834518ea6828729b9'
}
let
(
:branch_with_dot
)
{
project
.
repository
.
find_branch
(
'ends-with.json'
)
}
...
...
@@ -40,7 +40,9 @@ describe API::Branches do
end
context
'when unauthenticated'
,
'and project is public'
do
let
(
:project
)
{
create
(
:project
,
:public
,
:repository
)
}
before
do
project
.
update
(
visibility_level:
Gitlab
::
VisibilityLevel
::
PUBLIC
)
end
it_behaves_like
'repository branches'
end
...
...
@@ -118,7 +120,9 @@ describe API::Branches do
end
context
'when unauthenticated'
,
'and project is public'
do
let
(
:project
)
{
create
(
:project
,
:public
,
:repository
)
}
before
do
project
.
update
(
visibility_level:
Gitlab
::
VisibilityLevel
::
PUBLIC
)
end
it_behaves_like
'repository branch'
end
...
...
spec/requests/api/broadcast_messages_spec.rb
View file @
3914af2f
require
'spec_helper'
describe
API
::
BroadcastMessages
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:admin
)
{
create
(
:admin
)
}
set
(
:user
)
{
create
(
:user
)
}
set
(
:admin
)
{
create
(
:admin
)
}
set
(
:message
)
{
create
(
:broadcast_message
)
}
describe
'GET /broadcast_messages'
do
it
'returns a 401 for anonymous users'
do
...
...
@@ -31,8 +32,6 @@ describe API::BroadcastMessages do
end
describe
'GET /broadcast_messages/:id'
do
let!
(
:message
)
{
create
(
:broadcast_message
)
}
it
'returns a 401 for anonymous users'
do
get
api
(
"/broadcast_messages/
#{
message
.
id
}
"
)
...
...
@@ -103,8 +102,6 @@ describe API::BroadcastMessages do
end
describe
'PUT /broadcast_messages/:id'
do
let!
(
:message
)
{
create
(
:broadcast_message
)
}
it
'returns a 401 for anonymous users'
do
put
api
(
"/broadcast_messages/
#{
message
.
id
}
"
),
attributes_for
(
:broadcast_message
)
...
...
@@ -155,8 +152,6 @@ describe API::BroadcastMessages do
end
describe
'DELETE /broadcast_messages/:id'
do
let!
(
:message
)
{
create
(
:broadcast_message
)
}
it
'returns a 401 for anonymous users'
do
delete
api
(
"/broadcast_messages/
#{
message
.
id
}
"
),
attributes_for
(
:broadcast_message
)
...
...
spec/requests/api/v3/award_emoji_spec.rb
View file @
3914af2f
require
'spec_helper'
describe
API
::
V3
::
AwardEmoji
do
let
(
:user
)
{
create
(
:user
)
}
let!
(
:project
)
{
create
(
:project
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
let!
(
:award_emoji
)
{
create
(
:award_emoji
,
awardable:
issue
,
user:
user
)
}
let!
(
:merge_request
)
{
create
(
:merge_request
,
source_project:
project
,
target_project:
project
)
}
let!
(
:downvote
)
{
create
(
:award_emoji
,
:downvote
,
awardable:
merge_request
,
user:
user
)
}
let!
(
:note
)
{
create
(
:note
,
project:
project
,
noteable:
issue
)
}
set
(
:user
)
{
create
(
:user
)
}
set
(
:project
)
{
create
(
:project
)
}
set
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
set
(
:award_emoji
)
{
create
(
:award_emoji
,
awardable:
issue
,
user:
user
)
}
let!
(
:merge_request
)
{
create
(
:merge_request
,
source_project:
project
,
target_project:
project
)
}
let!
(
:downvote
)
{
create
(
:award_emoji
,
:downvote
,
awardable:
merge_request
,
user:
user
)
}
set
(
:note
)
{
create
(
:note
,
project:
project
,
noteable:
issue
)
}
before
{
project
.
team
<<
[
user
,
:master
]
}
...
...
spec/requests/api/v3/boards_spec.rb
View file @
3914af2f
require
'spec_helper'
describe
API
::
V3
::
Boards
do
l
et
(
:user
)
{
create
(
:user
)
}
l
et
(
:guest
)
{
create
(
:user
)
}
l
et
(
:non_member
)
{
create
(
:user
)
}
let!
(
:project
)
{
create
(
:project
,
:public
,
creator_id:
user
.
id
,
namespace:
user
.
namespace
)
}
s
et
(
:user
)
{
create
(
:user
)
}
s
et
(
:guest
)
{
create
(
:user
)
}
s
et
(
:non_member
)
{
create
(
:user
)
}
set
(
:project
)
{
create
(
:project
,
:public
,
creator_id:
user
.
id
,
namespace:
user
.
namespace
)
}
let!
(
:dev_label
)
do
set
(
:dev_label
)
do
create
(
:label
,
title:
'Development'
,
color:
'#FFAABB'
,
project:
project
)
end
let!
(
:test_label
)
do
set
(
:test_label
)
do
create
(
:label
,
title:
'Testing'
,
color:
'#FFAACC'
,
project:
project
)
end
let!
(
:dev_list
)
do
set
(
:dev_list
)
do
create
(
:list
,
label:
dev_label
,
position:
1
)
end
let!
(
:test_list
)
do
set
(
:test_list
)
do
create
(
:list
,
label:
test_label
,
position:
2
)
end
let!
(
:board
)
do
set
(
:board
)
do
create
(
:board
,
project:
project
,
lists:
[
dev_list
,
test_list
])
end
...
...
@@ -98,8 +98,11 @@ describe API::V3::Boards do
end
context
"when the user is project owner"
do
let
(
:owner
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
,
namespace:
owner
.
namespace
)
}
set
(
:owner
)
{
create
(
:user
)
}
before
do
project
.
update
(
namespace:
owner
.
namespace
)
end
it
"deletes the list if an admin requests it"
do
delete
v3_api
(
"
#{
base_url
}
/
#{
dev_list
.
id
}
"
,
owner
)
...
...
spec/requests/api/v3/branches_spec.rb
View file @
3914af2f
...
...
@@ -2,11 +2,11 @@ require 'spec_helper'
require
'mime/types'
describe
API
::
V3
::
Branches
do
l
et
(
:user
)
{
create
(
:user
)
}
l
et
(
:user2
)
{
create
(
:user
)
}
let!
(
:project
)
{
create
(
:project
,
:repository
,
creator:
user
)
}
let!
(
:master
)
{
create
(
:project_member
,
:master
,
user:
user
,
project:
project
)
}
let!
(
:guest
)
{
create
(
:project_member
,
:guest
,
user:
user2
,
project:
project
)
}
s
et
(
:user
)
{
create
(
:user
)
}
s
et
(
:user2
)
{
create
(
:user
)
}
set
(
:project
)
{
create
(
:project
,
:repository
,
creator:
user
)
}
set
(
:master
)
{
create
(
:project_member
,
:master
,
user:
user
,
project:
project
)
}
set
(
:guest
)
{
create
(
:project_member
,
:guest
,
user:
user2
,
project:
project
)
}
let!
(
:branch_name
)
{
'feature'
}
let!
(
:branch_sha
)
{
'0b4bc9a49b562e85de7cc9e834518ea6828729b9'
}
let!
(
:branch_with_dot
)
{
CreateBranchService
.
new
(
project
,
user
).
execute
(
"with.1.2.3"
,
"master"
)
}
...
...
spec/requests/api/v3/broadcast_messages_spec.rb
View file @
3914af2f
require
'spec_helper'
describe
API
::
V3
::
BroadcastMessages
do
l
et
(
:user
)
{
create
(
:user
)
}
l
et
(
:admin
)
{
create
(
:admin
)
}
s
et
(
:user
)
{
create
(
:user
)
}
s
et
(
:admin
)
{
create
(
:admin
)
}
describe
'DELETE /broadcast_messages/:id'
do
let!
(
:message
)
{
create
(
:broadcast_message
)
}
set
(
:message
)
{
create
(
:broadcast_message
)
}
it
'returns a 401 for anonymous users'
do
delete
v3_api
(
"/broadcast_messages/
#{
message
.
id
}
"
),
...
...
spec/requests/api/v3/builds_spec.rb
View file @
3914af2f
require
'spec_helper'
describe
API
::
V3
::
Builds
do
l
et
(
:user
)
{
create
(
:user
)
}
s
et
(
:user
)
{
create
(
:user
)
}
let
(
:api_user
)
{
user
}
let!
(
:project
)
{
create
(
:project
,
:repository
,
creator:
user
,
public_builds:
false
)
}
let!
(
:developer
)
{
create
(
:project_member
,
:developer
,
user:
user
,
project:
project
)
}
l
et
(
:reporter
)
{
create
(
:project_member
,
:reporter
,
project:
project
)
}
l
et
(
:guest
)
{
create
(
:project_member
,
:guest
,
project:
project
)
}
let!
(
:pipeline
)
{
create
(
:ci_empty_pipeline
,
project:
project
,
sha:
project
.
commit
.
id
,
ref:
project
.
default_branch
)
}
set
(
:project
)
{
create
(
:project
,
:repository
,
creator:
user
,
public_builds:
false
)
}
set
(
:developer
)
{
create
(
:project_member
,
:developer
,
user:
user
,
project:
project
)
}
s
et
(
:reporter
)
{
create
(
:project_member
,
:reporter
,
project:
project
)
}
s
et
(
:guest
)
{
create
(
:project_member
,
:guest
,
project:
project
)
}
set
(
:pipeline
)
{
create
(
:ci_empty_pipeline
,
project:
project
,
sha:
project
.
commit
.
id
,
ref:
project
.
default_branch
)
}
let!
(
:build
)
{
create
(
:ci_build
,
pipeline:
pipeline
)
}
describe
'GET /projects/:id/builds '
do
...
...
spec/requests/api/v3/issues_spec.rb
View file @
3914af2f
require
'spec_helper'
describe
API
::
V3
::
Issues
,
:mailer
do
l
et
(
:user
)
{
create
(
:user
)
}
l
et
(
:user2
)
{
create
(
:user
)
}
l
et
(
:non_member
)
{
create
(
:user
)
}
l
et
(
:guest
)
{
create
(
:user
)
}
l
et
(
:author
)
{
create
(
:author
)
}
l
et
(
:assignee
)
{
create
(
:assignee
)
}
l
et
(
:admin
)
{
create
(
:user
,
:admin
)
}
s
et
(
:user
)
{
create
(
:user
)
}
s
et
(
:user2
)
{
create
(
:user
)
}
s
et
(
:non_member
)
{
create
(
:user
)
}
s
et
(
:guest
)
{
create
(
:user
)
}
s
et
(
:author
)
{
create
(
:author
)
}
s
et
(
:assignee
)
{
create
(
:assignee
)
}
s
et
(
:admin
)
{
create
(
:user
,
:admin
)
}
let!
(
:project
)
{
create
(
:project
,
:public
,
creator_id:
user
.
id
,
namespace:
user
.
namespace
)
}
let!
(
:closed_issue
)
do
create
:closed_issue
,
...
...
@@ -822,7 +822,8 @@ describe API::V3::Issues, :mailer do
end
context
'resolving issues in a merge request'
do
let
(
:discussion
)
{
create
(
:diff_note_on_merge_request
).
to_discussion
}
set
(
:diff_note_on_merge_request
)
{
create
(
:diff_note_on_merge_request
)
}
let
(
:discussion
)
{
diff_note_on_merge_request
.
to_discussion
}
let
(
:merge_request
)
{
discussion
.
noteable
}
let
(
:project
)
{
merge_request
.
source_project
}
before
do
...
...
@@ -1169,7 +1170,7 @@ describe API::V3::Issues, :mailer do
end
context
"when the user is project owner"
do
l
et
(
:owner
)
{
create
(
:user
)
}
s
et
(
:owner
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
,
namespace:
owner
.
namespace
)
}
it
"deletes the issue if an admin requests it"
do
...
...
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