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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
9a31ecbe
Commit
9a31ecbe
authored
Jan 26, 2017
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use `:empty_project` where possible in request specs
parent
f27721e8
Changes
17
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
44 additions
and
44 deletions
+44
-44
spec/requests/api/branches_spec.rb
spec/requests/api/branches_spec.rb
+1
-1
spec/requests/api/builds_spec.rb
spec/requests/api/builds_spec.rb
+1
-1
spec/requests/api/commit_statuses_spec.rb
spec/requests/api/commit_statuses_spec.rb
+1
-1
spec/requests/api/commits_spec.rb
spec/requests/api/commits_spec.rb
+1
-1
spec/requests/api/files_spec.rb
spec/requests/api/files_spec.rb
+2
-2
spec/requests/api/fork_spec.rb
spec/requests/api/fork_spec.rb
+9
-12
spec/requests/api/internal_spec.rb
spec/requests/api/internal_spec.rb
+1
-1
spec/requests/api/merge_requests_spec.rb
spec/requests/api/merge_requests_spec.rb
+9
-7
spec/requests/api/pipelines_spec.rb
spec/requests/api/pipelines_spec.rb
+1
-1
spec/requests/api/projects_spec.rb
spec/requests/api/projects_spec.rb
+1
-0
spec/requests/api/repositories_spec.rb
spec/requests/api/repositories_spec.rb
+7
-7
spec/requests/api/tags_spec.rb
spec/requests/api/tags_spec.rb
+3
-3
spec/requests/api/triggers_spec.rb
spec/requests/api/triggers_spec.rb
+1
-1
spec/requests/ci/api/triggers_spec.rb
spec/requests/ci/api/triggers_spec.rb
+3
-3
spec/requests/git_http_spec.rb
spec/requests/git_http_spec.rb
+1
-1
spec/requests/projects/artifacts_controller_spec.rb
spec/requests/projects/artifacts_controller_spec.rb
+1
-1
spec/requests/projects/cycle_analytics_events_spec.rb
spec/requests/projects/cycle_analytics_events_spec.rb
+1
-1
No files found.
spec/requests/api/branches_spec.rb
View file @
9a31ecbe
...
...
@@ -6,7 +6,7 @@ describe API::Branches, api: true do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user2
)
{
create
(
:user
)
}
let!
(
:project
)
{
create
(
:project
,
creator_id:
user
.
id
)
}
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
)
}
let!
(
:branch_name
)
{
'feature'
}
...
...
spec/requests/api/builds_spec.rb
View file @
9a31ecbe
...
...
@@ -5,7 +5,7 @@ describe API::Builds, api: true do
let
(
:user
)
{
create
(
:user
)
}
let
(
:api_user
)
{
user
}
let!
(
:project
)
{
create
(
:project
,
creator_id:
user
.
id
,
public_builds:
false
)
}
let!
(
:project
)
{
create
(
:project
,
:repository
,
creator:
user
,
public_builds:
false
)
}
let!
(
:developer
)
{
create
(
:project_member
,
:developer
,
user:
user
,
project:
project
)
}
let
(
:reporter
)
{
create
(
:project_member
,
:reporter
,
project:
project
)
}
let
(
:guest
)
{
create
(
:project_member
,
:guest
,
project:
project
)
}
...
...
spec/requests/api/commit_statuses_spec.rb
View file @
9a31ecbe
...
...
@@ -3,7 +3,7 @@ require 'spec_helper'
describe
API
::
CommitStatuses
,
api:
true
do
include
ApiHelpers
let!
(
:project
)
{
create
(
:project
)
}
let!
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:commit
)
{
project
.
repository
.
commit
}
let
(
:commit_status
)
{
create
(
:commit_status
,
pipeline:
pipeline
)
}
let
(
:guest
)
{
create_user
(
:guest
)
}
...
...
spec/requests/api/commits_spec.rb
View file @
9a31ecbe
...
...
@@ -5,7 +5,7 @@ describe API::Commits, api: true do
include
ApiHelpers
let
(
:user
)
{
create
(
:user
)
}
let
(
:user2
)
{
create
(
:user
)
}
let!
(
:project
)
{
create
(
:project
,
creator_id:
user
.
id
,
namespace:
user
.
namespace
)
}
let!
(
:project
)
{
create
(
:project
,
:repository
,
creator:
user
,
namespace:
user
.
namespace
)
}
let!
(
:master
)
{
create
(
:project_member
,
:master
,
user:
user
,
project:
project
)
}
let!
(
:guest
)
{
create
(
:project_member
,
:guest
,
user:
user2
,
project:
project
)
}
let!
(
:note
)
{
create
(
:note_on_commit
,
author:
user
,
project:
project
,
commit_id:
project
.
repository
.
commit
.
id
,
note:
'a comment on a commit'
)
}
...
...
spec/requests/api/files_spec.rb
View file @
9a31ecbe
...
...
@@ -3,8 +3,8 @@ require 'spec_helper'
describe
API
::
Files
,
api:
true
do
include
ApiHelpers
let
(
:user
)
{
create
(
:user
)
}
let!
(
:project
)
{
create
(
:project
,
namespace:
user
.
namespace
)
}
let
(
:guest
)
{
create
(
:user
)
.
tap
{
|
u
|
create
(
:project_member
,
:guest
,
user:
u
,
project:
project
)
}
}
let!
(
:project
)
{
create
(
:project
,
:repository
,
namespace:
user
.
namespace
)
}
let
(
:guest
)
{
create
(
:user
)
{
|
u
|
project
.
add_guest
(
u
)
}
}
let
(
:file_path
)
{
'files/ruby/popen.rb'
}
let
(
:params
)
do
{
...
...
spec/requests/api/fork_spec.rb
View file @
9a31ecbe
...
...
@@ -4,7 +4,6 @@ describe API::Projects, api: true do
include
ApiHelpers
let
(
:user
)
{
create
(
:user
)
}
let
(
:user2
)
{
create
(
:user
)
}
let
(
:user3
)
{
create
(
:user
)
}
let
(
:admin
)
{
create
(
:admin
)
}
let
(
:group
)
{
create
(
:group
)
}
let
(
:group2
)
do
...
...
@@ -13,18 +12,15 @@ describe API::Projects, api: true do
group
end
describe
'POST /projects/fork/:id'
do
let
(
:project
)
do
create
(
:project
,
creator_id:
user
.
id
,
namespace:
user
.
namespace
)
create
(
:project
,
:repository
,
creator:
user
,
namespace:
user
.
namespace
)
end
let
(
:project_user2
)
do
create
(
:project_member
,
:reporter
,
user:
user2
,
project:
project
)
before
do
project
.
add_reporter
(
user2
)
end
describe
'POST /projects/fork/:id'
do
before
{
project_user2
}
before
{
user3
}
context
'when authenticated'
do
it
'forks if user has sufficient access to project'
do
post
api
(
"/projects/fork/
#{
project
.
id
}
"
,
user2
)
...
...
@@ -49,7 +45,8 @@ describe API::Projects, api: true do
end
it
'fails on missing project access for the project to fork'
do
post
api
(
"/projects/fork/
#{
project
.
id
}
"
,
user3
)
new_user
=
create
(
:user
)
post
api
(
"/projects/fork/
#{
project
.
id
}
"
,
new_user
)
expect
(
response
).
to
have_http_status
(
404
)
expect
(
json_response
[
'message'
]).
to
eq
(
'404 Project Not Found'
)
...
...
spec/requests/api/internal_spec.rb
View file @
9a31ecbe
...
...
@@ -4,7 +4,7 @@ describe API::Internal, api: true do
include
ApiHelpers
let
(
:user
)
{
create
(
:user
)
}
let
(
:key
)
{
create
(
:key
,
user:
user
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:secret_token
)
{
Gitlab
::
Shell
.
secret_token
}
describe
"GET /internal/check"
,
no_db:
true
do
...
...
spec/requests/api/merge_requests_spec.rb
View file @
9a31ecbe
...
...
@@ -6,12 +6,10 @@ describe API::MergeRequests, api: true do
let
(
:user
)
{
create
(
:user
)
}
let
(
:admin
)
{
create
(
:user
,
:admin
)
}
let
(
:non_member
)
{
create
(
:user
)
}
let!
(
:project
)
{
create
(
:project
,
:public
,
creator_id:
user
.
id
,
namespace:
user
.
namespace
)
}
let!
(
:merge_request
)
{
create
(
:merge_request
,
:simple
,
author:
user
,
assignee:
user
,
source_project:
project
,
target_project:
project
,
title:
"Test"
,
created_at:
base_time
)
}
let!
(
:merge_request_closed
)
{
create
(
:merge_request
,
state:
"closed"
,
author:
user
,
assignee:
user
,
source_project:
project
,
target_project:
project
,
title:
"Closed test"
,
created_at:
base_time
+
1
.
second
)
}
let!
(
:merge_request_merged
)
{
create
(
:merge_request
,
state:
"merged"
,
author:
user
,
assignee:
user
,
source_project:
project
,
target_project:
project
,
title:
"Merged test"
,
created_at:
base_time
+
2
.
seconds
,
merge_commit_sha:
'9999999999999999999999999999999999999999'
)
}
let!
(
:note
)
{
create
(
:note_on_merge_request
,
author:
user
,
project:
project
,
noteable:
merge_request
,
note:
"a comment on a MR"
)
}
let!
(
:note2
)
{
create
(
:note_on_merge_request
,
author:
user
,
project:
project
,
noteable:
merge_request
,
note:
"another comment on a MR"
)
}
let!
(
:project
)
{
create
(
:project
,
:public
,
:repository
,
creator:
user
,
namespace:
user
.
namespace
)
}
let!
(
:merge_request
)
{
create
(
:merge_request
,
:simple
,
author:
user
,
assignee:
user
,
source_project:
project
,
title:
"Test"
,
created_at:
base_time
)
}
let!
(
:merge_request_closed
)
{
create
(
:merge_request
,
state:
"closed"
,
author:
user
,
assignee:
user
,
source_project:
project
,
title:
"Closed test"
,
created_at:
base_time
+
1
.
second
)
}
let!
(
:merge_request_merged
)
{
create
(
:merge_request
,
state:
"merged"
,
author:
user
,
assignee:
user
,
source_project:
project
,
title:
"Merged test"
,
created_at:
base_time
+
2
.
seconds
,
merge_commit_sha:
'9999999999999999999999999999999999999999'
)
}
let
(
:milestone
)
{
create
(
:milestone
,
title:
'1.0.0'
,
project:
project
)
}
before
do
...
...
@@ -556,11 +554,12 @@ describe API::MergeRequests, api: true do
original_count
=
merge_request
.
notes
.
size
post
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
id
}
/comments"
,
user
),
note:
"My comment"
expect
(
response
).
to
have_http_status
(
201
)
expect
(
json_response
[
'note'
]).
to
eq
(
'My comment'
)
expect
(
json_response
[
'author'
][
'name'
]).
to
eq
(
user
.
name
)
expect
(
json_response
[
'author'
][
'username'
]).
to
eq
(
user
.
username
)
expect
(
merge_request
.
notes
.
size
).
to
eq
(
original_count
+
1
)
expect
(
merge_request
.
reload
.
notes
.
size
).
to
eq
(
original_count
+
1
)
end
it
"returns 400 if note is missing"
do
...
...
@@ -576,6 +575,9 @@ describe API::MergeRequests, api: true do
end
describe
"GET :id/merge_requests/:merge_request_id/comments"
do
let!
(
:note
)
{
create
(
:note_on_merge_request
,
author:
user
,
project:
project
,
noteable:
merge_request
,
note:
"a comment on a MR"
)
}
let!
(
:note2
)
{
create
(
:note_on_merge_request
,
author:
user
,
project:
project
,
noteable:
merge_request
,
note:
"another comment on a MR"
)
}
it
"returns merge_request comments ordered by created_at"
do
get
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
id
}
/comments"
,
user
)
expect
(
response
).
to
have_http_status
(
200
)
...
...
spec/requests/api/pipelines_spec.rb
View file @
9a31ecbe
...
...
@@ -5,7 +5,7 @@ describe API::Pipelines, api: true do
let
(
:user
)
{
create
(
:user
)
}
let
(
:non_member
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
,
creator_id:
user
.
id
)
}
let
(
:project
)
{
create
(
:project
,
:repository
,
creator:
user
)
}
let!
(
:pipeline
)
do
create
(
:ci_empty_pipeline
,
project:
project
,
sha:
project
.
commit
.
id
,
...
...
spec/requests/api/projects_spec.rb
View file @
9a31ecbe
...
...
@@ -17,6 +17,7 @@ describe API::Projects, api: true do
let
(
:project3
)
do
create
(
:project
,
:private
,
:repository
,
name:
'second_project'
,
path:
'second_project'
,
creator_id:
user
.
id
,
...
...
spec/requests/api/repositories_spec.rb
View file @
9a31ecbe
...
...
@@ -8,7 +8,7 @@ describe API::Repositories, api: true do
let
(
:user
)
{
create
(
:user
)
}
let
(
:guest
)
{
create
(
:user
).
tap
{
|
u
|
create
(
:project_member
,
:guest
,
user:
u
,
project:
project
)
}
}
let!
(
:project
)
{
create
(
:project
,
creator_id:
user
.
id
)
}
let!
(
:project
)
{
create
(
:project
,
:repository
,
creator:
user
)
}
let!
(
:master
)
{
create
(
:project_member
,
:master
,
user:
user
,
project:
project
)
}
describe
"GET /projects/:id/repository/tree"
do
...
...
@@ -74,7 +74,7 @@ describe API::Repositories, api: true do
context
'when unauthenticated'
,
'and project is public'
do
it_behaves_like
'repository tree'
do
let
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:project
)
{
create
(
:project
,
:public
,
:repository
)
}
let
(
:current_user
)
{
nil
}
end
end
...
...
@@ -144,7 +144,7 @@ describe API::Repositories, api: true do
context
'when unauthenticated'
,
'and project is public'
do
it_behaves_like
'repository blob'
do
let
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:project
)
{
create
(
:project
,
:public
,
:repository
)
}
let
(
:current_user
)
{
nil
}
end
end
...
...
@@ -198,7 +198,7 @@ describe API::Repositories, api: true do
context
'when unauthenticated'
,
'and project is public'
do
it_behaves_like
'repository raw blob'
do
let
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:project
)
{
create
(
:project
,
:public
,
:repository
)
}
let
(
:current_user
)
{
nil
}
end
end
...
...
@@ -273,7 +273,7 @@ describe API::Repositories, api: true do
context
'when unauthenticated'
,
'and project is public'
do
it_behaves_like
'repository archive'
do
let
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:project
)
{
create
(
:project
,
:public
,
:repository
)
}
let
(
:current_user
)
{
nil
}
end
end
...
...
@@ -347,7 +347,7 @@ describe API::Repositories, api: true do
context
'when unauthenticated'
,
'and project is public'
do
it_behaves_like
'repository compare'
do
let
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:project
)
{
create
(
:project
,
:public
,
:repository
)
}
let
(
:current_user
)
{
nil
}
end
end
...
...
@@ -394,7 +394,7 @@ describe API::Repositories, api: true do
context
'when unauthenticated'
,
'and project is public'
do
it_behaves_like
'repository contributors'
do
let
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:project
)
{
create
(
:project
,
:public
,
:repository
)
}
let
(
:current_user
)
{
nil
}
end
end
...
...
spec/requests/api/tags_spec.rb
View file @
9a31ecbe
...
...
@@ -7,7 +7,7 @@ describe API::Tags, api: true do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user2
)
{
create
(
:user
)
}
let!
(
:project
)
{
create
(
:project
,
creator_id:
user
.
id
)
}
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
)
}
...
...
@@ -29,7 +29,7 @@ describe API::Tags, api: true do
context
'when unauthenticated'
do
it_behaves_like
'repository tags'
do
let
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:project
)
{
create
(
:project
,
:public
,
:repository
)
}
let
(
:current_user
)
{
nil
}
end
end
...
...
@@ -88,7 +88,7 @@ describe API::Tags, api: true do
context
'when unauthenticated'
do
it_behaves_like
'repository tag'
do
let
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:project
)
{
create
(
:project
,
:public
,
:repository
)
}
let
(
:current_user
)
{
nil
}
end
end
...
...
spec/requests/api/triggers_spec.rb
View file @
9a31ecbe
...
...
@@ -7,7 +7,7 @@ describe API::Triggers do
let
(
:user2
)
{
create
(
:user
)
}
let!
(
:trigger_token
)
{
'secure_token'
}
let!
(
:trigger_token_2
)
{
'secure_token_2'
}
let!
(
:project
)
{
create
(
:project
,
creator_id:
user
.
id
)
}
let!
(
:project
)
{
create
(
:project
,
:repository
,
creator:
user
)
}
let!
(
:master
)
{
create
(
:project_member
,
:master
,
user:
user
,
project:
project
)
}
let!
(
:developer
)
{
create
(
:project_member
,
:developer
,
user:
user2
,
project:
project
)
}
let!
(
:trigger
)
{
create
(
:ci_trigger
,
project:
project
,
token:
trigger_token
)
}
...
...
spec/requests/ci/api/triggers_spec.rb
View file @
9a31ecbe
...
...
@@ -5,9 +5,9 @@ describe Ci::API::Triggers do
describe
'POST /projects/:project_id/refs/:ref/trigger'
do
let!
(
:trigger_token
)
{
'secure token'
}
let!
(
:project
)
{
FactoryGirl
.
create
(
:project
,
ci_id:
10
)
}
let!
(
:project2
)
{
FactoryGirl
.
create
(
:empty_project
,
ci_id:
11
)
}
let!
(
:trigger
)
{
FactoryGirl
.
create
(
:ci_trigger
,
project:
project
,
token:
trigger_token
)
}
let!
(
:project
)
{
create
(
:project
,
:repository
,
ci_id:
10
)
}
let!
(
:project2
)
{
create
(
:empty_project
,
ci_id:
11
)
}
let!
(
:trigger
)
{
create
(
:ci_trigger
,
project:
project
,
token:
trigger_token
)
}
let
(
:options
)
do
{
token:
trigger_token
...
...
spec/requests/git_http_spec.rb
View file @
9a31ecbe
...
...
@@ -12,7 +12,7 @@ describe 'Git HTTP requests', lib: true do
describe
"User with no identities"
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
,
path:
'project.git-project'
)
}
let
(
:project
)
{
create
(
:project
,
:repository
,
path:
'project.git-project'
)
}
context
"when the project doesn't exist"
do
context
"when no authentication is provided"
do
...
...
spec/requests/projects/artifacts_controller_spec.rb
View file @
9a31ecbe
...
...
@@ -2,7 +2,7 @@ require 'spec_helper'
describe
Projects
::
ArtifactsController
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:pipeline
)
do
create
(
:ci_pipeline
,
...
...
spec/requests/projects/cycle_analytics_events_spec.rb
View file @
9a31ecbe
...
...
@@ -4,7 +4,7 @@ describe 'cycle analytics events' do
include
ApiHelpers
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
,
public_builds:
false
)
}
let
(
:project
)
{
create
(
:project
,
:repository
,
public_builds:
false
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
project
,
created_at:
2
.
days
.
ago
)
}
describe
'GET /:namespace/:project/cycle_analytics/events/issues'
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