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
b9f25a24
Commit
b9f25a24
authored
Jan 04, 2019
by
Jasper Maes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix deprecation: Using positional arguments in specs for EE spes in spec/
parent
235e49c8
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
49 additions
and
44 deletions
+49
-44
ee/changelogs/unreleased/deprecated-positional-spec-arguments.yml
...elogs/unreleased/deprecated-positional-spec-arguments.yml
+5
-0
ee/spec/controllers/groups/epic_links_controller_spec.rb
ee/spec/controllers/groups/epic_links_controller_spec.rb
+4
-4
ee/spec/controllers/groups/security/vulnerabilities_controller_spec.rb
...ollers/groups/security/vulnerabilities_controller_spec.rb
+1
-1
ee/spec/controllers/projects/issues_controller_spec.rb
ee/spec/controllers/projects/issues_controller_spec.rb
+1
-1
ee/spec/controllers/projects/prometheus/alerts_controller_spec.rb
...controllers/projects/prometheus/alerts_controller_spec.rb
+3
-3
ee/spec/requests/api/npm_packages_spec.rb
ee/spec/requests/api/npm_packages_spec.rb
+3
-3
spec/controllers/groups/group_members_controller_spec.rb
spec/controllers/groups/group_members_controller_spec.rb
+6
-6
spec/controllers/groups_controller_spec.rb
spec/controllers/groups_controller_spec.rb
+4
-4
spec/requests/api/branches_spec.rb
spec/requests/api/branches_spec.rb
+1
-1
spec/requests/api/groups_spec.rb
spec/requests/api/groups_spec.rb
+6
-6
spec/requests/api/jobs_spec.rb
spec/requests/api/jobs_spec.rb
+1
-1
spec/requests/api/members_spec.rb
spec/requests/api/members_spec.rb
+1
-1
spec/requests/api/projects_spec.rb
spec/requests/api/projects_spec.rb
+1
-1
spec/requests/api/protected_branches_spec.rb
spec/requests/api/protected_branches_spec.rb
+10
-10
spec/requests/api/services_spec.rb
spec/requests/api/services_spec.rb
+1
-1
spec/requests/api/triggers_spec.rb
spec/requests/api/triggers_spec.rb
+1
-1
No files found.
ee/changelogs/unreleased/deprecated-positional-spec-arguments.yml
0 → 100644
View file @
b9f25a24
---
title
:
'
Fix
deprecation:
Using
positional
arguments
in
specs
for
EE
spes
in
spec/'
merge_request
:
9040
author
:
Jasper Maes
type
:
other
ee/spec/controllers/groups/epic_links_controller_spec.rb
View file @
b9f25a24
...
@@ -45,7 +45,7 @@ describe Groups::EpicLinksController, :postgresql do
...
@@ -45,7 +45,7 @@ describe Groups::EpicLinksController, :postgresql do
epic1
.
update
(
parent:
parent_epic
)
epic1
.
update
(
parent:
parent_epic
)
end
end
subject
{
get
:index
,
group_id:
group
,
epic_id:
parent_epic
.
to_param
}
subject
{
get
:index
,
params:
{
group_id:
group
,
epic_id:
parent_epic
.
to_param
}
}
it_behaves_like
'unlicensed epics action'
it_behaves_like
'unlicensed epics action'
it_behaves_like
'feature flag disabled'
it_behaves_like
'feature flag disabled'
...
@@ -72,7 +72,7 @@ describe Groups::EpicLinksController, :postgresql do
...
@@ -72,7 +72,7 @@ describe Groups::EpicLinksController, :postgresql do
subject
do
subject
do
reference
=
[
epic1
.
to_reference
(
full:
true
)]
reference
=
[
epic1
.
to_reference
(
full:
true
)]
post
:create
,
group_id:
group
,
epic_id:
parent_epic
.
to_param
,
issuable_references:
reference
post
:create
,
params:
{
group_id:
group
,
epic_id:
parent_epic
.
to_param
,
issuable_references:
reference
}
end
end
it_behaves_like
'unlicensed epics action'
it_behaves_like
'unlicensed epics action'
...
@@ -121,7 +121,7 @@ describe Groups::EpicLinksController, :postgresql do
...
@@ -121,7 +121,7 @@ describe Groups::EpicLinksController, :postgresql do
epic1
.
update
(
parent:
parent_epic
)
epic1
.
update
(
parent:
parent_epic
)
end
end
subject
{
delete
:destroy
,
group_id:
group
,
epic_id:
parent_epic
.
to_param
,
id:
epic1
.
id
}
subject
{
delete
:destroy
,
params:
{
group_id:
group
,
epic_id:
parent_epic
.
to_param
,
id:
epic1
.
id
}
}
it_behaves_like
'unlicensed epics action'
it_behaves_like
'unlicensed epics action'
it_behaves_like
'feature flag disabled'
it_behaves_like
'feature flag disabled'
...
@@ -162,7 +162,7 @@ describe Groups::EpicLinksController, :postgresql do
...
@@ -162,7 +162,7 @@ describe Groups::EpicLinksController, :postgresql do
context
'when the epic does not have any parent'
do
context
'when the epic does not have any parent'
do
it
'returns status 404'
do
it
'returns status 404'
do
delete
:destroy
,
group_id:
group
,
epic_id:
parent_epic
.
to_param
,
id:
epic2
.
id
delete
:destroy
,
params:
{
group_id:
group
,
epic_id:
parent_epic
.
to_param
,
id:
epic2
.
id
}
expect
(
response
.
status
).
to
eq
(
403
)
expect
(
response
.
status
).
to
eq
(
403
)
end
end
...
...
ee/spec/controllers/groups/security/vulnerabilities_controller_spec.rb
View file @
b9f25a24
...
@@ -231,7 +231,7 @@ describe Groups::Security::VulnerabilitiesController do
...
@@ -231,7 +231,7 @@ describe Groups::Security::VulnerabilitiesController do
context
'with enabled filters'
do
context
'with enabled filters'
do
it
'returns counts for filtered vulnerabilities'
do
it
'returns counts for filtered vulnerabilities'
do
get
:summary
,
group_id:
group
,
report_type:
%w[sast dast]
,
severity:
%[high low]
,
format: :json
get
:summary
,
params:
{
group_id:
group
,
report_type:
%w[sast dast]
,
severity:
%[high low]
}
,
format: :json
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
json_response
).
to
be_an
(
Hash
)
expect
(
json_response
).
to
be_an
(
Hash
)
...
...
ee/spec/controllers/projects/issues_controller_spec.rb
View file @
b9f25a24
...
@@ -105,7 +105,7 @@ describe Projects::IssuesController do
...
@@ -105,7 +105,7 @@ describe Projects::IssuesController do
end
end
def
perform
(
method
,
action
,
opts
=
{})
def
perform
(
method
,
action
,
opts
=
{})
send
(
method
,
action
,
opts
.
merge
(
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
))
send
(
method
,
action
,
params:
opts
.
merge
(
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
))
end
end
context
'licensed'
do
context
'licensed'
do
...
...
ee/spec/controllers/projects/prometheus/alerts_controller_spec.rb
View file @
b9f25a24
...
@@ -115,7 +115,7 @@ describe Projects::Prometheus::AlertsController do
...
@@ -115,7 +115,7 @@ describe Projects::Prometheus::AlertsController do
expect
(
notify_service
).
to
receive
(
:execute
).
with
(
'some token'
)
expect
(
notify_service
).
to
receive
(
:execute
).
with
(
'some token'
)
post
:notify
,
project_params
,
as: :json
post
:notify
,
p
arams:
p
roject_params
,
as: :json
end
end
it
'pass nil if cannot extract a non-bearer token'
do
it
'pass nil if cannot extract a non-bearer token'
do
...
@@ -123,7 +123,7 @@ describe Projects::Prometheus::AlertsController do
...
@@ -123,7 +123,7 @@ describe Projects::Prometheus::AlertsController do
expect
(
notify_service
).
to
receive
(
:execute
).
with
(
nil
)
expect
(
notify_service
).
to
receive
(
:execute
).
with
(
nil
)
post
:notify
,
project_params
,
as: :json
post
:notify
,
p
arams:
p
roject_params
,
as: :json
end
end
end
end
...
@@ -131,7 +131,7 @@ describe Projects::Prometheus::AlertsController do
...
@@ -131,7 +131,7 @@ describe Projects::Prometheus::AlertsController do
it
'passes nil'
do
it
'passes nil'
do
expect
(
notify_service
)
.
to
receive
(
:execute
).
with
(
nil
)
expect
(
notify_service
)
.
to
receive
(
:execute
).
with
(
nil
)
post
:notify
,
project_params
,
as: :json
post
:notify
,
p
arams:
p
roject_params
,
as: :json
end
end
end
end
end
end
...
...
ee/spec/requests/api/npm_packages_spec.rb
View file @
b9f25a24
...
@@ -81,7 +81,7 @@ describe API::NpmPackages do
...
@@ -81,7 +81,7 @@ describe API::NpmPackages do
end
end
def
get_package
(
package
,
params
=
{})
def
get_package
(
package
,
params
=
{})
get
api
(
"/packages/npm/
#{
package
.
name
}
"
),
params
get
api
(
"/packages/npm/
#{
package
.
name
}
"
),
params
:
params
end
end
def
get_package_with_token
(
package
,
params
=
{})
def
get_package_with_token
(
package
,
params
=
{})
...
@@ -139,7 +139,7 @@ describe API::NpmPackages do
...
@@ -139,7 +139,7 @@ describe API::NpmPackages do
def
get_file
(
package_file
,
params
=
{})
def
get_file
(
package_file
,
params
=
{})
get
api
(
"/projects/
#{
project
.
id
}
/packages/npm/"
\
get
api
(
"/projects/
#{
project
.
id
}
/packages/npm/"
\
"
#{
package_file
.
package
.
name
}
/-/
#{
package_file
.
file_name
}
"
),
params
"
#{
package_file
.
package
.
name
}
/-/
#{
package_file
.
file_name
}
"
),
params
:
params
end
end
def
get_file_with_token
(
package_file
,
params
=
{})
def
get_file_with_token
(
package_file
,
params
=
{})
...
@@ -176,7 +176,7 @@ describe API::NpmPackages do
...
@@ -176,7 +176,7 @@ describe API::NpmPackages do
end
end
def
upload_package
(
package_name
,
params
=
{})
def
upload_package
(
package_name
,
params
=
{})
put
api
(
"/projects/
#{
project
.
id
}
/packages/npm/
#{
package_name
.
sub
(
'/'
,
'%2f'
)
}
"
),
params
put
api
(
"/projects/
#{
project
.
id
}
/packages/npm/
#{
package_name
.
sub
(
'/'
,
'%2f'
)
}
"
),
params
:
params
end
end
def
upload_package_with_token
(
package_name
,
params
=
{})
def
upload_package_with_token
(
package_name
,
params
=
{})
...
...
spec/controllers/groups/group_members_controller_spec.rb
View file @
b9f25a24
...
@@ -56,9 +56,9 @@ describe Groups::GroupMembersController do
...
@@ -56,9 +56,9 @@ describe Groups::GroupMembersController do
it
'creates an audit event'
do
it
'creates an audit event'
do
expect
do
expect
do
post
:create
,
group_id:
group
,
post
:create
,
params:
{
group_id:
group
,
user_ids:
group_user
.
id
,
user_ids:
group_user
.
id
,
access_level:
Gitlab
::
Access
::
GUEST
access_level:
Gitlab
::
Access
::
GUEST
}
end
.
to
change
(
AuditEvent
,
:count
).
by
(
1
)
end
.
to
change
(
AuditEvent
,
:count
).
by
(
1
)
end
end
...
@@ -184,7 +184,7 @@ describe Groups::GroupMembersController do
...
@@ -184,7 +184,7 @@ describe Groups::GroupMembersController do
end
end
it
'creates an audit event'
do
it
'creates an audit event'
do
expect
{
delete
:leave
,
group_id:
group
}.
to
change
(
AuditEvent
,
:count
).
by
(
1
)
expect
{
delete
:leave
,
params:
{
group_id:
group
}
}.
to
change
(
AuditEvent
,
:count
).
by
(
1
)
end
end
end
end
...
@@ -200,7 +200,7 @@ describe Groups::GroupMembersController do
...
@@ -200,7 +200,7 @@ describe Groups::GroupMembersController do
end
end
it
'does not create an audit event'
do
it
'does not create an audit event'
do
expect
{
delete
:leave
,
group_id:
group
}.
not_to
change
(
AuditEvent
,
:count
)
expect
{
delete
:leave
,
params:
{
group_id:
group
}
}.
not_to
change
(
AuditEvent
,
:count
)
end
end
end
end
...
@@ -219,7 +219,7 @@ describe Groups::GroupMembersController do
...
@@ -219,7 +219,7 @@ describe Groups::GroupMembersController do
end
end
it
'creates an audit event'
do
it
'creates an audit event'
do
expect
{
delete
:leave
,
group_id:
group
}.
to
change
(
AuditEvent
,
:count
).
by
(
1
)
expect
{
delete
:leave
,
params:
{
group_id:
group
}
}.
to
change
(
AuditEvent
,
:count
).
by
(
1
)
end
end
end
end
end
end
...
...
spec/controllers/groups_controller_spec.rb
View file @
b9f25a24
...
@@ -116,7 +116,7 @@ describe GroupsController do
...
@@ -116,7 +116,7 @@ describe GroupsController do
sign_in
(
user
)
sign_in
(
user
)
expect
do
expect
do
post
:create
,
group:
{
name:
'new_group'
,
path:
"new_group"
}
post
:create
,
params:
{
group:
{
name:
'new_group'
,
path:
"new_group"
}
}
end
.
to
change
{
Group
.
count
}.
by
(
1
)
end
.
to
change
{
Group
.
count
}.
by
(
1
)
expect
(
response
).
to
have_gitlab_http_status
(
302
)
expect
(
response
).
to
have_gitlab_http_status
(
302
)
...
@@ -127,7 +127,7 @@ describe GroupsController do
...
@@ -127,7 +127,7 @@ describe GroupsController do
sign_in
(
create
(
:admin
))
sign_in
(
create
(
:admin
))
expect
do
expect
do
post
:create
,
group:
{
name:
'new_group'
,
path:
"new_group"
}
post
:create
,
params:
{
group:
{
name:
'new_group'
,
path:
"new_group"
}
}
end
.
to
change
{
Group
.
count
}.
by
(
1
)
end
.
to
change
{
Group
.
count
}.
by
(
1
)
expect
(
response
).
to
have_gitlab_http_status
(
302
)
expect
(
response
).
to
have_gitlab_http_status
(
302
)
...
@@ -137,7 +137,7 @@ describe GroupsController do
...
@@ -137,7 +137,7 @@ describe GroupsController do
sign_in
(
create
(
:user
,
:auditor
,
can_create_group:
true
))
sign_in
(
create
(
:user
,
:auditor
,
can_create_group:
true
))
expect
do
expect
do
post
:create
,
group:
{
name:
'new_group'
,
path:
"new_group"
}
post
:create
,
params:
{
group:
{
name:
'new_group'
,
path:
"new_group"
}
}
end
.
to
change
{
Group
.
count
}.
by
(
1
)
end
.
to
change
{
Group
.
count
}.
by
(
1
)
expect
(
response
).
to
have_gitlab_http_status
(
302
)
expect
(
response
).
to
have_gitlab_http_status
(
302
)
...
@@ -352,7 +352,7 @@ describe GroupsController do
...
@@ -352,7 +352,7 @@ describe GroupsController do
end
end
it
'updates the project_creation_level successfully'
do
it
'updates the project_creation_level successfully'
do
post
:update
,
id:
group
.
to_param
,
group:
{
project_creation_level:
::
EE
::
Gitlab
::
Access
::
MAINTAINER_PROJECT_ACCESS
}
post
:update
,
params:
{
id:
group
.
to_param
,
group:
{
project_creation_level:
::
EE
::
Gitlab
::
Access
::
MAINTAINER_PROJECT_ACCESS
}
}
expect
(
response
).
to
have_gitlab_http_status
(
302
)
expect
(
response
).
to
have_gitlab_http_status
(
302
)
expect
(
group
.
reload
.
project_creation_level
).
to
eq
(
::
EE
::
Gitlab
::
Access
::
MAINTAINER_PROJECT_ACCESS
)
expect
(
group
.
reload
.
project_creation_level
).
to
eq
(
::
EE
::
Gitlab
::
Access
::
MAINTAINER_PROJECT_ACCESS
)
...
...
spec/requests/api/branches_spec.rb
View file @
b9f25a24
...
@@ -419,7 +419,7 @@ describe API::Branches do
...
@@ -419,7 +419,7 @@ describe API::Branches do
it
"updates 'developers_can_push' without removing the 'no_one' access level"
do
it
"updates 'developers_can_push' without removing the 'no_one' access level"
do
put
api
(
"/projects/
#{
project
.
id
}
/repository/branches/
#{
protected_branch
.
name
}
/protect"
,
user
),
put
api
(
"/projects/
#{
project
.
id
}
/repository/branches/
#{
protected_branch
.
name
}
/protect"
,
user
),
developers_can_push:
true
,
developers_can_merge:
true
params:
{
developers_can_push:
true
,
developers_can_merge:
true
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
json_response
[
'name'
]).
to
eq
(
protected_branch
.
name
)
expect
(
json_response
[
'name'
]).
to
eq
(
protected_branch
.
name
)
...
...
spec/requests/api/groups_spec.rb
View file @
b9f25a24
...
@@ -456,7 +456,7 @@ describe API::Groups do
...
@@ -456,7 +456,7 @@ describe API::Groups do
# EE
# EE
it
'returns 403 for updating shared_runners_minutes_limit'
do
it
'returns 403 for updating shared_runners_minutes_limit'
do
expect
do
expect
do
put
api
(
"/groups/
#{
group1
.
id
}
"
,
user1
),
shared_runners_minutes_limit:
133
put
api
(
"/groups/
#{
group1
.
id
}
"
,
user1
),
params:
{
shared_runners_minutes_limit:
133
}
end
.
not_to
change
{
group1
.
shared_runners_minutes_limit
}
end
.
not_to
change
{
group1
.
shared_runners_minutes_limit
}
expect
(
response
).
to
have_gitlab_http_status
(
403
)
expect
(
response
).
to
have_gitlab_http_status
(
403
)
...
@@ -466,7 +466,7 @@ describe API::Groups do
...
@@ -466,7 +466,7 @@ describe API::Groups do
group1
.
update
(
shared_runners_minutes_limit:
133
)
group1
.
update
(
shared_runners_minutes_limit:
133
)
expect
do
expect
do
put
api
(
"/groups/
#{
group1
.
id
}
"
,
user1
),
shared_runners_minutes_limit:
133
put
api
(
"/groups/
#{
group1
.
id
}
"
,
user1
),
params:
{
shared_runners_minutes_limit:
133
}
end
.
not_to
change
{
group1
.
shared_runners_minutes_limit
}
end
.
not_to
change
{
group1
.
shared_runners_minutes_limit
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
...
@@ -484,7 +484,7 @@ describe API::Groups do
...
@@ -484,7 +484,7 @@ describe API::Groups do
# EE
# EE
it
'updates the group for shared_runners_minutes_limit'
do
it
'updates the group for shared_runners_minutes_limit'
do
expect
do
expect
do
put
api
(
"/groups/
#{
group1
.
id
}
"
,
admin
),
shared_runners_minutes_limit:
133
put
api
(
"/groups/
#{
group1
.
id
}
"
,
admin
),
params:
{
shared_runners_minutes_limit:
133
}
end
.
to
change
{
group1
.
reload
.
shared_runners_minutes_limit
}
end
.
to
change
{
group1
.
reload
.
shared_runners_minutes_limit
}
.
from
(
nil
).
to
(
133
)
.
from
(
nil
).
to
(
133
)
...
@@ -888,7 +888,7 @@ describe API::Groups do
...
@@ -888,7 +888,7 @@ describe API::Groups do
it
"creates an ldap_group_link if ldap_cn and ldap_access are supplied"
do
it
"creates an ldap_group_link if ldap_cn and ldap_access are supplied"
do
group_attributes
=
attributes_for
(
:group
,
ldap_cn:
'ldap-group'
,
ldap_access:
Gitlab
::
Access
::
DEVELOPER
)
group_attributes
=
attributes_for
(
:group
,
ldap_cn:
'ldap-group'
,
ldap_access:
Gitlab
::
Access
::
DEVELOPER
)
expect
{
post
api
(
"/groups"
,
admin
),
group_attributes
}.
to
change
{
LdapGroupLink
.
count
}.
by
(
1
)
expect
{
post
api
(
"/groups"
,
admin
),
params:
group_attributes
}.
to
change
{
LdapGroupLink
.
count
}.
by
(
1
)
end
end
# EE
# EE
...
@@ -898,7 +898,7 @@ describe API::Groups do
...
@@ -898,7 +898,7 @@ describe API::Groups do
group
=
attributes_for
(
:group
,
{
shared_runners_minutes_limit:
133
})
group
=
attributes_for
(
:group
,
{
shared_runners_minutes_limit:
133
})
expect
do
expect
do
post
api
(
"/groups"
,
user3
),
group
post
api
(
"/groups"
,
user3
),
params:
group
end
.
not_to
change
{
Group
.
count
}
end
.
not_to
change
{
Group
.
count
}
expect
(
response
).
to
have_gitlab_http_status
(
403
)
expect
(
response
).
to
have_gitlab_http_status
(
403
)
...
@@ -910,7 +910,7 @@ describe API::Groups do
...
@@ -910,7 +910,7 @@ describe API::Groups do
group
=
attributes_for
(
:group
,
{
shared_runners_minutes_limit:
133
})
group
=
attributes_for
(
:group
,
{
shared_runners_minutes_limit:
133
})
expect
do
expect
do
post
api
(
"/groups"
,
admin
),
group
post
api
(
"/groups"
,
admin
),
params:
group
end
.
to
change
{
Group
.
count
}.
by
(
1
)
end
.
to
change
{
Group
.
count
}.
by
(
1
)
created_group
=
Group
.
find
(
json_response
[
'id'
])
created_group
=
Group
.
find
(
json_response
[
'id'
])
...
...
spec/requests/api/jobs_spec.rb
View file @
b9f25a24
...
@@ -611,7 +611,7 @@ describe API::Jobs do
...
@@ -611,7 +611,7 @@ describe API::Jobs do
pipeline
.
update
(
ref:
'master'
,
pipeline
.
update
(
ref:
'master'
,
sha:
project
.
commit
(
'master'
).
sha
)
sha:
project
.
commit
(
'master'
).
sha
)
get
api
(
"/projects/
#{
project
.
id
}
/jobs/artifacts/master/download"
),
job:
job
.
name
,
job_token:
job
.
token
get
api
(
"/projects/
#{
project
.
id
}
/jobs/artifacts/master/download"
),
params:
{
job:
job
.
name
,
job_token:
job
.
token
}
end
end
context
'when user is reporter'
do
context
'when user is reporter'
do
...
...
spec/requests/api/members_spec.rb
View file @
b9f25a24
...
@@ -302,7 +302,7 @@ describe API::Members do
...
@@ -302,7 +302,7 @@ describe API::Members do
project
.
group
.
add_owner
(
maintainer
)
project
.
group
.
add_owner
(
maintainer
)
post
api
(
"/projects/
#{
project
.
id
}
/members"
,
maintainer
),
post
api
(
"/projects/
#{
project
.
id
}
/members"
,
maintainer
),
user_id:
developer
.
id
,
access_level:
Member
::
MAINTAINER
params:
{
user_id:
developer
.
id
,
access_level:
Member
::
MAINTAINER
}
expect
(
response
.
status
).
to
eq
405
expect
(
response
.
status
).
to
eq
405
end
end
...
...
spec/requests/api/projects_spec.rb
View file @
b9f25a24
...
@@ -1632,7 +1632,7 @@ describe API::Projects do
...
@@ -1632,7 +1632,7 @@ describe API::Projects do
it
'updates approvals_before_merge'
do
it
'updates approvals_before_merge'
do
project_param
=
{
approvals_before_merge:
3
}
project_param
=
{
approvals_before_merge:
3
}
put
api
(
"/projects/
#{
project
.
id
}
"
,
user
),
project_param
put
api
(
"/projects/
#{
project
.
id
}
"
,
user
),
p
arams:
p
roject_param
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
json_response
[
'approvals_before_merge'
]).
to
eq
(
3
)
expect
(
json_response
[
'approvals_before_merge'
]).
to
eq
(
3
)
...
...
spec/requests/api/protected_branches_spec.rb
View file @
b9f25a24
...
@@ -195,7 +195,7 @@ describe API::ProtectedBranches do
...
@@ -195,7 +195,7 @@ describe API::ProtectedBranches do
end
end
it
'protects a single branch and only admins can unprotect'
do
it
'protects a single branch and only admins can unprotect'
do
post
post_endpoint
,
name:
branch_name
,
unprotect_access_level:
Gitlab
::
Access
::
ADMIN
post
post_endpoint
,
params:
{
name:
branch_name
,
unprotect_access_level:
Gitlab
::
Access
::
ADMIN
}
expect
(
response
).
to
have_gitlab_http_status
(
201
)
expect
(
response
).
to
have_gitlab_http_status
(
201
)
expect
(
json_response
[
'name'
]).
to
eq
(
branch_name
)
expect
(
json_response
[
'name'
]).
to
eq
(
branch_name
)
...
@@ -225,7 +225,7 @@ describe API::ProtectedBranches do
...
@@ -225,7 +225,7 @@ describe API::ProtectedBranches do
it
'can protect a branch while allowing an individual user to push'
do
it
'can protect a branch while allowing an individual user to push'
do
push_user
=
project_member
push_user
=
project_member
post
post_endpoint
,
name:
branch_name
,
allowed_to_push:
[{
user_id:
push_user
.
id
}]
post
post_endpoint
,
params:
{
name:
branch_name
,
allowed_to_push:
[{
user_id:
push_user
.
id
}]
}
expect_protection_to_be_successful
expect_protection_to_be_successful
expect
(
json_response
[
'push_access_levels'
][
0
][
'user_id'
]).
to
eq
(
push_user
.
id
)
expect
(
json_response
[
'push_access_levels'
][
0
][
'user_id'
]).
to
eq
(
push_user
.
id
)
...
@@ -234,7 +234,7 @@ describe API::ProtectedBranches do
...
@@ -234,7 +234,7 @@ describe API::ProtectedBranches do
it
'can protect a branch while allowing an individual user to merge'
do
it
'can protect a branch while allowing an individual user to merge'
do
merge_user
=
project_member
merge_user
=
project_member
post
post_endpoint
,
name:
branch_name
,
allowed_to_merge:
[{
user_id:
merge_user
.
id
}]
post
post_endpoint
,
params:
{
name:
branch_name
,
allowed_to_merge:
[{
user_id:
merge_user
.
id
}]
}
expect_protection_to_be_successful
expect_protection_to_be_successful
expect
(
json_response
[
'merge_access_levels'
][
0
][
'user_id'
]).
to
eq
(
merge_user
.
id
)
expect
(
json_response
[
'merge_access_levels'
][
0
][
'user_id'
]).
to
eq
(
merge_user
.
id
)
...
@@ -243,7 +243,7 @@ describe API::ProtectedBranches do
...
@@ -243,7 +243,7 @@ describe API::ProtectedBranches do
it
'can protect a branch while allowing an individual user to unprotect'
do
it
'can protect a branch while allowing an individual user to unprotect'
do
unprotect_user
=
project_member
unprotect_user
=
project_member
post
post_endpoint
,
name:
branch_name
,
allowed_to_unprotect:
[{
user_id:
unprotect_user
.
id
}]
post
post_endpoint
,
params:
{
name:
branch_name
,
allowed_to_unprotect:
[{
user_id:
unprotect_user
.
id
}]
}
expect_protection_to_be_successful
expect_protection_to_be_successful
expect
(
json_response
[
'unprotect_access_levels'
][
0
][
'user_id'
]).
to
eq
(
unprotect_user
.
id
)
expect
(
json_response
[
'unprotect_access_levels'
][
0
][
'user_id'
]).
to
eq
(
unprotect_user
.
id
)
...
@@ -252,7 +252,7 @@ describe API::ProtectedBranches do
...
@@ -252,7 +252,7 @@ describe API::ProtectedBranches do
it
'can protect a branch while allowing a group to push'
do
it
'can protect a branch while allowing a group to push'
do
push_group
=
invited_group
push_group
=
invited_group
post
post_endpoint
,
name:
branch_name
,
allowed_to_push:
[{
group_id:
push_group
.
id
}]
post
post_endpoint
,
params:
{
name:
branch_name
,
allowed_to_push:
[{
group_id:
push_group
.
id
}]
}
expect_protection_to_be_successful
expect_protection_to_be_successful
expect
(
json_response
[
'push_access_levels'
][
0
][
'group_id'
]).
to
eq
(
push_group
.
id
)
expect
(
json_response
[
'push_access_levels'
][
0
][
'group_id'
]).
to
eq
(
push_group
.
id
)
...
@@ -261,7 +261,7 @@ describe API::ProtectedBranches do
...
@@ -261,7 +261,7 @@ describe API::ProtectedBranches do
it
'can protect a branch while allowing a group to merge'
do
it
'can protect a branch while allowing a group to merge'
do
merge_group
=
invited_group
merge_group
=
invited_group
post
post_endpoint
,
name:
branch_name
,
allowed_to_merge:
[{
group_id:
merge_group
.
id
}]
post
post_endpoint
,
params:
{
name:
branch_name
,
allowed_to_merge:
[{
group_id:
merge_group
.
id
}]
}
expect_protection_to_be_successful
expect_protection_to_be_successful
expect
(
json_response
[
'merge_access_levels'
][
0
][
'group_id'
]).
to
eq
(
merge_group
.
id
)
expect
(
json_response
[
'merge_access_levels'
][
0
][
'group_id'
]).
to
eq
(
merge_group
.
id
)
...
@@ -270,7 +270,7 @@ describe API::ProtectedBranches do
...
@@ -270,7 +270,7 @@ describe API::ProtectedBranches do
it
'can protect a branch while allowing a group to unprotect'
do
it
'can protect a branch while allowing a group to unprotect'
do
unprotect_group
=
invited_group
unprotect_group
=
invited_group
post
post_endpoint
,
name:
branch_name
,
allowed_to_unprotect:
[{
group_id:
unprotect_group
.
id
}]
post
post_endpoint
,
params:
{
name:
branch_name
,
allowed_to_unprotect:
[{
group_id:
unprotect_group
.
id
}]
}
expect_protection_to_be_successful
expect_protection_to_be_successful
expect
(
json_response
[
'unprotect_access_levels'
][
0
][
'group_id'
]).
to
eq
(
unprotect_group
.
id
)
expect
(
json_response
[
'unprotect_access_levels'
][
0
][
'group_id'
]).
to
eq
(
unprotect_group
.
id
)
...
@@ -279,7 +279,7 @@ describe API::ProtectedBranches do
...
@@ -279,7 +279,7 @@ describe API::ProtectedBranches do
it
"fails if users don't all have access to the project"
do
it
"fails if users don't all have access to the project"
do
push_user
=
create
(
:user
)
push_user
=
create
(
:user
)
post
post_endpoint
,
name:
branch_name
,
allowed_to_merge:
[{
user_id:
push_user
.
id
}]
post
post_endpoint
,
params:
{
name:
branch_name
,
allowed_to_merge:
[{
user_id:
push_user
.
id
}]
}
expect
(
response
).
to
have_gitlab_http_status
(
422
)
expect
(
response
).
to
have_gitlab_http_status
(
422
)
expect
(
json_response
[
'message'
][
0
]).
to
match
(
/Cannot add users or groups/
)
expect
(
json_response
[
'message'
][
0
]).
to
match
(
/Cannot add users or groups/
)
...
@@ -288,7 +288,7 @@ describe API::ProtectedBranches do
...
@@ -288,7 +288,7 @@ describe API::ProtectedBranches do
it
"fails if groups aren't all invited to the project"
do
it
"fails if groups aren't all invited to the project"
do
merge_group
=
create
(
:group
)
merge_group
=
create
(
:group
)
post
post_endpoint
,
name:
branch_name
,
allowed_to_merge:
[{
group_id:
merge_group
.
id
}]
post
post_endpoint
,
params:
{
name:
branch_name
,
allowed_to_merge:
[{
group_id:
merge_group
.
id
}]
}
expect
(
response
).
to
have_gitlab_http_status
(
422
)
expect
(
response
).
to
have_gitlab_http_status
(
422
)
expect
(
json_response
[
'message'
][
0
]).
to
match
(
/Cannot add users or groups/
)
expect
(
json_response
[
'message'
][
0
]).
to
match
(
/Cannot add users or groups/
)
...
@@ -297,7 +297,7 @@ describe API::ProtectedBranches do
...
@@ -297,7 +297,7 @@ describe API::ProtectedBranches do
it
'avoids creating default access levels unless necessary'
do
it
'avoids creating default access levels unless necessary'
do
push_user
=
project_member
push_user
=
project_member
post
post_endpoint
,
name:
branch_name
,
allowed_to_push:
[{
user_id:
push_user
.
id
}]
post
post_endpoint
,
params:
{
name:
branch_name
,
allowed_to_push:
[{
user_id:
push_user
.
id
}]
}
expect
(
response
).
to
have_gitlab_http_status
(
201
)
expect
(
response
).
to
have_gitlab_http_status
(
201
)
expect
(
json_response
[
'push_access_levels'
].
count
).
to
eq
(
1
)
expect
(
json_response
[
'push_access_levels'
].
count
).
to
eq
(
1
)
...
...
spec/requests/api/services_spec.rb
View file @
b9f25a24
...
@@ -209,7 +209,7 @@ describe API::Services do
...
@@ -209,7 +209,7 @@ describe API::Services do
end
end
it
'returns status 200'
do
it
'returns status 200'
do
post
api
(
'/slack/trigger'
),
token:
'token'
,
text:
'help'
post
api
(
'/slack/trigger'
),
params:
{
token:
'token'
,
text:
'help'
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
json_response
[
'response_type'
]).
to
eq
(
"ephemeral"
)
expect
(
json_response
[
'response_type'
]).
to
eq
(
"ephemeral"
)
...
...
spec/requests/api/triggers_spec.rb
View file @
b9f25a24
...
@@ -135,7 +135,7 @@ describe API::Triggers do
...
@@ -135,7 +135,7 @@ describe API::Triggers do
let
(
:params
)
{
{
ref:
'refs/heads/other-branch'
}
}
let
(
:params
)
{
{
ref:
'refs/heads/other-branch'
}
}
subject
do
subject
do
post
api
(
"/projects/
#{
project
.
id
}
/ref/master/trigger/pipeline?token=
#{
other_job
.
token
}
"
),
params
post
api
(
"/projects/
#{
project
.
id
}
/ref/master/trigger/pipeline?token=
#{
other_job
.
token
}
"
),
params
:
params
end
end
context
'without user'
do
context
'without user'
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