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
f64ba502
Commit
f64ba502
authored
Feb 09, 2019
by
Jasper Maes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Using positional arguments in request specs have been deprecated
parent
544397b8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
16 deletions
+21
-16
ee/changelogs/unreleased/deprecated-spec-positional-args.yml
ee/changelogs/unreleased/deprecated-spec-positional-args.yml
+5
-0
ee/spec/requests/api/merge_request_approvals_spec.rb
ee/spec/requests/api/merge_request_approvals_spec.rb
+12
-12
ee/spec/requests/api/project_approval_rules_spec.rb
ee/spec/requests/api/project_approval_rules_spec.rb
+4
-4
No files found.
ee/changelogs/unreleased/deprecated-spec-positional-args.yml
0 → 100644
View file @
f64ba502
---
title
:
Using positional arguments in request specs have been deprecated
merge_request
:
9506
author
:
Jasper Maes
type
:
other
ee/spec/requests/api/merge_request_approvals_spec.rb
View file @
f64ba502
...
...
@@ -548,7 +548,7 @@ describe "API::MergeRequestApprovals with approval_rule enabled" do
it
'allows you to override approvals required'
do
expect
do
post
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
iid
}
/approvals"
,
current_user
),
approvals_required:
5
post
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
iid
}
/approvals"
,
current_user
),
params:
{
approvals_required:
5
}
end
.
to
change
{
merge_request
.
reload
.
approvals_before_merge
}.
from
(
nil
).
to
(
5
)
expect
(
response
).
to
have_gitlab_http_status
(
201
)
...
...
@@ -562,7 +562,7 @@ describe "API::MergeRequestApprovals with approval_rule enabled" do
it
'does not include an error in the response'
do
expect
do
post
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
iid
}
/approvals"
,
current_user
),
approvals_required:
0
post
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
iid
}
/approvals"
,
current_user
),
params:
{
approvals_required:
0
}
end
.
to
change
{
merge_request
.
reload
.
approvals_before_merge
}.
from
(
nil
).
to
(
0
)
expect
(
json_response
[
'message'
]).
to
eq
(
nil
)
end
...
...
@@ -576,7 +576,7 @@ describe "API::MergeRequestApprovals with approval_rule enabled" do
it
'does not allow you to override approvals required'
do
expect
do
post
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
iid
}
/approvals"
,
current_user
),
approvals_required:
5
post
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
iid
}
/approvals"
,
current_user
),
params:
{
approvals_required:
5
}
end
.
not_to
change
{
merge_request
.
reload
.
approvals_before_merge
}
expect
(
response
).
to
have_gitlab_http_status
(
422
)
...
...
@@ -587,7 +587,7 @@ describe "API::MergeRequestApprovals with approval_rule enabled" do
private_group
=
create
(
:group
,
:private
)
merge_request
.
approver_groups
.
create
(
group:
private_group
)
post
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
iid
}
/approvals"
,
current_user
),
approvals_required:
5
post
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
iid
}
/approvals"
,
current_user
),
params:
{
approvals_required:
5
}
expect
(
response
).
to
have_gitlab_http_status
(
201
)
expect
(
json_response
[
'approver_groups'
].
size
).
to
eq
(
expected_approver_group_size
)
...
...
@@ -615,7 +615,7 @@ describe "API::MergeRequestApprovals with approval_rule enabled" do
it
'does not allow you to override approvals required'
do
expect
do
post
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
iid
}
/approvals"
,
user2
),
approvals_required:
5
post
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
iid
}
/approvals"
,
user2
),
params:
{
approvals_required:
5
}
end
.
not_to
change
{
merge_request
.
reload
.
approvals_before_merge
}
expect
(
response
).
to
have_gitlab_http_status
(
403
)
...
...
@@ -635,7 +635,7 @@ describe "API::MergeRequestApprovals with approval_rule enabled" do
it
'does not allow overriding approvers'
do
expect
do
put
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
iid
}
/approvers"
,
current_user
),
approver_ids:
[
approver
.
id
],
approver_group_ids:
[
group
.
id
]
params:
{
approver_ids:
[
approver
.
id
],
approver_group_ids:
[
group
.
id
]
}
end
.
to
not_change
{
merge_request
.
approvers
.
count
}.
and
not_change
{
merge_request
.
approver_groups
.
count
}
end
end
...
...
@@ -648,7 +648,7 @@ describe "API::MergeRequestApprovals with approval_rule enabled" do
it
'allows overriding approvers'
do
expect
do
put
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
iid
}
/approvers"
,
current_user
),
approver_ids:
[
approver
.
id
],
approver_group_ids:
[
group
.
id
]
params:
{
approver_ids:
[
approver
.
id
],
approver_group_ids:
[
group
.
id
]
}
end
.
to
change
{
merge_request
.
approvers
.
count
}.
from
(
0
).
to
(
1
)
.
and
change
{
merge_request
.
approver_groups
.
count
}.
from
(
0
).
to
(
1
)
...
...
@@ -663,7 +663,7 @@ describe "API::MergeRequestApprovals with approval_rule enabled" do
expect
do
put
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
iid
}
/approvers"
,
current_user
),
{
approver_ids:
[],
approver_group_ids:
[]
}.
to_json
,
{
CONTENT_TYPE
:
'application/json'
}
params:
{
approver_ids:
[],
approver_group_ids:
[]
}.
to_json
,
headers:
{
CONTENT_TYPE
:
'application/json'
}
end
.
to
change
{
merge_request
.
approvers
.
count
}.
from
(
1
).
to
(
0
)
.
and
change
{
merge_request
.
approver_groups
.
count
}.
from
(
1
).
to
(
0
)
...
...
@@ -678,7 +678,7 @@ describe "API::MergeRequestApprovals with approval_rule enabled" do
expect
do
put
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
iid
}
/approvers"
,
current_user
),
approver_ids:
''
,
approver_group_ids:
''
params:
{
approver_ids:
''
,
approver_group_ids:
''
}
end
.
to
change
{
merge_request
.
approvers
.
count
}.
from
(
1
).
to
(
0
)
.
and
change
{
merge_request
.
approver_groups
.
count
}.
from
(
1
).
to
(
0
)
...
...
@@ -693,7 +693,7 @@ describe "API::MergeRequestApprovals with approval_rule enabled" do
merge_request
.
approver_groups
.
create
(
group:
private_group
)
put
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
iid
}
/approvers"
,
current_user
),
approver_ids:
[
approver
.
id
],
approver_group_ids:
[
private_group
.
id
,
group
.
id
]
params:
{
approver_ids:
[
approver
.
id
],
approver_group_ids:
[
private_group
.
id
,
group
.
id
]
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
json_response
[
'approver_groups'
].
size
).
to
eq
(
expected_group_size
)
...
...
@@ -722,7 +722,7 @@ describe "API::MergeRequestApprovals with approval_rule enabled" do
it
'does not allow overriding approvers'
do
expect
do
put
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
iid
}
/approvers"
,
user2
),
approver_ids:
[
approver
.
id
],
approver_group_ids:
[
group
.
id
]
params:
{
approver_ids:
[
approver
.
id
],
approver_group_ids:
[
group
.
id
]
}
end
.
to
not_change
{
merge_request
.
approvers
.
count
}.
and
not_change
{
merge_request
.
approver_groups
.
count
}
expect
(
response
).
to
have_gitlab_http_status
(
403
)
...
...
@@ -753,7 +753,7 @@ describe "API::MergeRequestApprovals with approval_rule enabled" do
end
def
approve
(
extra_params
=
{})
post
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
iid
}
/approve"
,
approver
),
extra_params
post
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
iid
}
/approve"
,
approver
),
params:
extra_params
end
context
'when the sha param is not set'
do
...
...
ee/spec/requests/api/project_approval_rules_spec.rb
View file @
f64ba502
...
...
@@ -93,7 +93,7 @@ describe API::ProjectApprovalRules do
context
'when user is without access'
do
it
'returns 403'
do
post
api
(
url
,
user2
),
params
post
api
(
url
,
user2
),
params
:
params
expect
(
response
).
to
have_gitlab_http_status
(
403
)
end
...
...
@@ -101,7 +101,7 @@ describe API::ProjectApprovalRules do
context
'when the request is correct'
do
it
'returns 201 status'
do
post
api
(
url
,
current_user
),
params
post
api
(
url
,
current_user
),
params
:
params
expect
(
response
).
to
have_gitlab_http_status
(
201
)
expect
(
response
).
to
match_response_schema
(
'public_api/v4/project_approval_rule'
,
dir:
'ee'
)
...
...
@@ -114,7 +114,7 @@ describe API::ProjectApprovalRules do
project
.
disable_overriding_approvers_per_merge_request
=
true
project
.
save
post
api
(
url
,
current_user
),
params
post
api
(
url
,
current_user
),
params
:
params
expect
(
json_response
.
symbolize_keys
).
to
include
(
params
)
end
...
...
@@ -179,7 +179,7 @@ describe API::ProjectApprovalRules do
project
.
approvers
.
create
(
user:
approver
)
expect
do
put
api
(
url
,
user2
),
{
users:
[],
groups:
[]
}.
to_json
,
{
CONTENT_TYPE
:
'application/json'
}
put
api
(
url
,
user2
),
params:
{
users:
[],
groups:
[]
}.
to_json
,
headers:
{
CONTENT_TYPE
:
'application/json'
}
end
.
not_to
change
{
approval_rule
.
approvers
.
size
}
expect
(
response
).
to
have_gitlab_http_status
(
403
)
...
...
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