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
41570730
Commit
41570730
authored
Aug 16, 2018
by
sliaquat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove some duplicate tests and fix some typos
parent
ce18246c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
6 additions
and
114 deletions
+6
-114
spec/requests/api/project_hooks_spec.rb
spec/requests/api/project_hooks_spec.rb
+0
-5
spec/requests/api/project_import_spec.rb
spec/requests/api/project_import_spec.rb
+1
-1
spec/requests/api/projects_spec.rb
spec/requests/api/projects_spec.rb
+5
-100
spec/support/api/milestones_shared_examples.rb
spec/support/api/milestones_shared_examples.rb
+0
-8
No files found.
spec/requests/api/project_hooks_spec.rb
View file @
41570730
...
@@ -83,11 +83,6 @@ describe API::ProjectHooks, 'ProjectHooks' do
...
@@ -83,11 +83,6 @@ describe API::ProjectHooks, 'ProjectHooks' do
expect
(
response
).
to
have_gitlab_http_status
(
403
)
expect
(
response
).
to
have_gitlab_http_status
(
403
)
end
end
end
end
it
"returns a 404 error if hook id is not available"
do
get
api
(
"/projects/
#{
project
.
id
}
/hooks/1234"
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
404
)
end
end
end
describe
"POST /projects/:id/hooks"
do
describe
"POST /projects/:id/hooks"
do
...
...
spec/requests/api/project_import_spec.rb
View file @
41570730
...
@@ -42,7 +42,7 @@ describe API::ProjectImport do
...
@@ -42,7 +42,7 @@ describe API::ProjectImport do
expect
(
response
).
to
have_gitlab_http_status
(
201
)
expect
(
response
).
to
have_gitlab_http_status
(
201
)
end
end
it
'does not s
hedule an import for a namp
espace that does not exist'
do
it
'does not s
chedule an import for a nam
espace that does not exist'
do
expect_any_instance_of
(
Project
).
not_to
receive
(
:import_schedule
)
expect_any_instance_of
(
Project
).
not_to
receive
(
:import_schedule
)
expect
(
::
Projects
::
CreateService
).
not_to
receive
(
:new
)
expect
(
::
Projects
::
CreateService
).
not_to
receive
(
:new
)
...
...
spec/requests/api/projects_spec.rb
View file @
41570730
...
@@ -20,7 +20,6 @@ describe API::Projects do
...
@@ -20,7 +20,6 @@ describe API::Projects do
let
(
:admin
)
{
create
(
:admin
)
}
let
(
:admin
)
{
create
(
:admin
)
}
let
(
:project
)
{
create
(
:project
,
:repository
,
namespace:
user
.
namespace
)
}
let
(
:project
)
{
create
(
:project
,
:repository
,
namespace:
user
.
namespace
)
}
let
(
:project2
)
{
create
(
:project
,
namespace:
user
.
namespace
)
}
let
(
:project2
)
{
create
(
:project
,
namespace:
user
.
namespace
)
}
let
(
:snippet
)
{
create
(
:project_snippet
,
:public
,
author:
user
,
project:
project
,
title:
'example'
)
}
let
(
:project_member
)
{
create
(
:project_member
,
:developer
,
user:
user3
,
project:
project
)
}
let
(
:project_member
)
{
create
(
:project_member
,
:developer
,
user:
user3
,
project:
project
)
}
let
(
:user4
)
{
create
(
:user
)
}
let
(
:user4
)
{
create
(
:user
)
}
let
(
:project3
)
do
let
(
:project3
)
do
...
@@ -575,7 +574,7 @@ describe API::Projects do
...
@@ -575,7 +574,7 @@ describe API::Projects do
expect
(
json_response
[
'avatar_url'
]).
to
eq
(
"http://localhost/uploads/-/system/project/avatar/
#{
project_id
}
/banana_sample.gif"
)
expect
(
json_response
[
'avatar_url'
]).
to
eq
(
"http://localhost/uploads/-/system/project/avatar/
#{
project_id
}
/banana_sample.gif"
)
end
end
it
'sets a project as allowing outdated diff discussions to automatically resolve'
do
it
'sets a project as
not
allowing outdated diff discussions to automatically resolve'
do
project
=
attributes_for
(
:project
,
resolve_outdated_diff_discussions:
false
)
project
=
attributes_for
(
:project
,
resolve_outdated_diff_discussions:
false
)
post
api
(
'/projects'
,
user
),
project
post
api
(
'/projects'
,
user
),
project
...
@@ -583,7 +582,7 @@ describe API::Projects do
...
@@ -583,7 +582,7 @@ describe API::Projects do
expect
(
json_response
[
'resolve_outdated_diff_discussions'
]).
to
be_falsey
expect
(
json_response
[
'resolve_outdated_diff_discussions'
]).
to
be_falsey
end
end
it
'sets a project as allowing outdated diff discussions to automatically resolve
if resolve_outdated_diff_discussions
'
do
it
'sets a project as allowing outdated diff discussions to automatically resolve'
do
project
=
attributes_for
(
:project
,
resolve_outdated_diff_discussions:
true
)
project
=
attributes_for
(
:project
,
resolve_outdated_diff_discussions:
true
)
post
api
(
'/projects'
,
user
),
project
post
api
(
'/projects'
,
user
),
project
...
@@ -698,7 +697,7 @@ describe API::Projects do
...
@@ -698,7 +697,7 @@ describe API::Projects do
expect
(
json_response
.
map
{
|
project
|
project
[
'id'
]
}).
to
contain_exactly
(
public_project
.
id
)
expect
(
json_response
.
map
{
|
project
|
project
[
'id'
]
}).
to
contain_exactly
(
public_project
.
id
)
end
end
it
'returns projects fil
e
tered by minimal access level'
do
it
'returns projects filtered by minimal access level'
do
private_project1
=
create
(
:project
,
:private
,
name:
'private_project1'
,
creator_id:
user4
.
id
,
namespace:
user4
.
namespace
)
private_project1
=
create
(
:project
,
:private
,
name:
'private_project1'
,
creator_id:
user4
.
id
,
namespace:
user4
.
namespace
)
private_project2
=
create
(
:project
,
:private
,
name:
'private_project2'
,
creator_id:
user4
.
id
,
namespace:
user4
.
namespace
)
private_project2
=
create
(
:project
,
:private
,
name:
'private_project2'
,
creator_id:
user4
.
id
,
namespace:
user4
.
namespace
)
private_project1
.
add_developer
(
user2
)
private_project1
.
add_developer
(
user2
)
...
@@ -789,7 +788,7 @@ describe API::Projects do
...
@@ -789,7 +788,7 @@ describe API::Projects do
expect
(
json_response
[
'visibility'
]).
to
eq
(
'private'
)
expect
(
json_response
[
'visibility'
]).
to
eq
(
'private'
)
end
end
it
'sets a project as allowing outdated diff discussions to automatically resolve'
do
it
'sets a project as
not
allowing outdated diff discussions to automatically resolve'
do
project
=
attributes_for
(
:project
,
resolve_outdated_diff_discussions:
false
)
project
=
attributes_for
(
:project
,
resolve_outdated_diff_discussions:
false
)
post
api
(
"/projects/user/
#{
user
.
id
}
"
,
admin
),
project
post
api
(
"/projects/user/
#{
user
.
id
}
"
,
admin
),
project
...
@@ -1119,100 +1118,6 @@ describe API::Projects do
...
@@ -1119,100 +1118,6 @@ describe API::Projects do
end
end
end
end
describe
'GET /projects/:id/snippets'
do
before
do
snippet
end
it
'returns an array of project snippets'
do
get
api
(
"/projects/
#{
project
.
id
}
/snippets"
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
first
[
'title'
]).
to
eq
(
snippet
.
title
)
end
end
describe
'GET /projects/:id/snippets/:snippet_id'
do
it
'returns a project snippet'
do
get
api
(
"/projects/
#{
project
.
id
}
/snippets/
#{
snippet
.
id
}
"
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
json_response
[
'title'
]).
to
eq
(
snippet
.
title
)
end
it
'returns a 404 error if snippet id not found'
do
get
api
(
"/projects/
#{
project
.
id
}
/snippets/1234"
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
404
)
end
end
describe
'POST /projects/:id/snippets'
do
it
'creates a new project snippet'
do
post
api
(
"/projects/
#{
project
.
id
}
/snippets"
,
user
),
title:
'api test'
,
file_name:
'sample.rb'
,
code:
'test'
,
visibility:
'private'
expect
(
response
).
to
have_gitlab_http_status
(
201
)
expect
(
json_response
[
'title'
]).
to
eq
(
'api test'
)
end
it
'returns a 400 error if invalid snippet is given'
do
post
api
(
"/projects/
#{
project
.
id
}
/snippets"
,
user
)
expect
(
status
).
to
eq
(
400
)
end
end
describe
'PUT /projects/:id/snippets/:snippet_id'
do
it
'updates an existing project snippet'
do
put
api
(
"/projects/
#{
project
.
id
}
/snippets/
#{
snippet
.
id
}
"
,
user
),
code:
'updated code'
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
json_response
[
'title'
]).
to
eq
(
'example'
)
expect
(
snippet
.
reload
.
content
).
to
eq
(
'updated code'
)
end
it
'updates an existing project snippet with new title'
do
put
api
(
"/projects/
#{
project
.
id
}
/snippets/
#{
snippet
.
id
}
"
,
user
),
title:
'other api test'
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
json_response
[
'title'
]).
to
eq
(
'other api test'
)
end
end
describe
'DELETE /projects/:id/snippets/:snippet_id'
do
before
do
snippet
end
it
'deletes existing project snippet'
do
expect
do
delete
api
(
"/projects/
#{
project
.
id
}
/snippets/
#{
snippet
.
id
}
"
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
204
)
end
.
to
change
{
Snippet
.
count
}.
by
(
-
1
)
end
it
'returns 404 when deleting unknown snippet id'
do
delete
api
(
"/projects/
#{
project
.
id
}
/snippets/1234"
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
404
)
end
it_behaves_like
'412 response'
do
let
(
:request
)
{
api
(
"/projects/
#{
project
.
id
}
/snippets/
#{
snippet
.
id
}
"
,
user
)
}
end
end
describe
'GET /projects/:id/snippets/:snippet_id/raw'
do
it
'gets a raw project snippet'
do
get
api
(
"/projects/
#{
project
.
id
}
/snippets/
#{
snippet
.
id
}
/raw"
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
end
it
'returns a 404 error if raw project snippet not found'
do
get
api
(
"/projects/
#{
project
.
id
}
/snippets/5555/raw"
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
404
)
end
end
describe
'fork management'
do
describe
'fork management'
do
let
(
:project_fork_target
)
{
create
(
:project
)
}
let
(
:project_fork_target
)
{
create
(
:project
)
}
let
(
:project_fork_source
)
{
create
(
:project
,
:public
)
}
let
(
:project_fork_source
)
{
create
(
:project
,
:public
)
}
...
@@ -1235,7 +1140,7 @@ describe API::Projects do
...
@@ -1235,7 +1140,7 @@ describe API::Projects do
expect
(
project_fork_target
.
forked?
).
to
be_truthy
expect
(
project_fork_target
.
forked?
).
to
be_truthy
end
end
it
'refreshes the forks count cach
c
e'
do
it
'refreshes the forks count cache'
do
expect
(
project_fork_source
.
forks_count
).
to
be_zero
expect
(
project_fork_source
.
forks_count
).
to
be_zero
post
api
(
"/projects/
#{
project_fork_target
.
id
}
/fork/
#{
project_fork_source
.
id
}
"
,
admin
)
post
api
(
"/projects/
#{
project_fork_target
.
id
}
/fork/
#{
project_fork_source
.
id
}
"
,
admin
)
...
...
spec/support/api/milestones_shared_examples.rb
View file @
41570730
...
@@ -102,14 +102,6 @@ shared_examples_for 'group and project milestones' do |route_definition|
...
@@ -102,14 +102,6 @@ shared_examples_for 'group and project milestones' do |route_definition|
expect
(
json_response
[
'iid'
]).
to
eq
(
milestone
.
iid
)
expect
(
json_response
[
'iid'
]).
to
eq
(
milestone
.
iid
)
end
end
it
'returns a milestone by id'
do
get
api
(
resource_route
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
json_response
[
'title'
]).
to
eq
(
milestone
.
title
)
expect
(
json_response
[
'iid'
]).
to
eq
(
milestone
.
iid
)
end
it
'returns 401 error if user not authenticated'
do
it
'returns 401 error if user not authenticated'
do
get
api
(
resource_route
)
get
api
(
resource_route
)
...
...
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