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
f54bc4fc
Commit
f54bc4fc
authored
Oct 09, 2020
by
Christian Couder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test for 'unassign' push option
parent
7d38a023
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
62 additions
and
0 deletions
+62
-0
spec/services/merge_requests/push_options_handler_service_spec.rb
...vices/merge_requests/push_options_handler_service_spec.rb
+62
-0
No files found.
spec/services/merge_requests/push_options_handler_service_spec.rb
View file @
f54bc4fc
...
...
@@ -680,6 +680,68 @@ RSpec.describe MergeRequests::PushOptionsHandlerService do
end
end
describe
'`unassign` push option'
do
let
(
:push_options
)
{
{
assign:
{
user2
.
id
=>
1
,
user3
.
id
=>
1
},
unassign:
{
user1
.
id
=>
1
,
user3
.
id
=>
1
}
}
}
context
'with a new branch'
do
let
(
:changes
)
{
new_branch_changes
}
it_behaves_like
'a service that does not create a merge request'
it
'adds an error to the service'
do
service
.
execute
expect
(
service
.
errors
).
to
include
(
error_mr_required
)
end
context
'when coupled with the `create` push option'
do
let
(
:push_options
)
{
{
create:
true
,
assign:
{
user2
.
id
=>
1
,
user3
.
id
=>
1
},
unassign:
{
user1
.
id
=>
1
,
user3
.
id
=>
1
}
}
}
it_behaves_like
'a service that can create a merge request'
it_behaves_like
'a service that can change one assignee of a merge request'
end
end
context
'with an existing branch but no open MR'
do
let
(
:changes
)
{
existing_branch_changes
}
it_behaves_like
'a service that does not create a merge request'
it
'adds an error to the service'
do
service
.
execute
expect
(
service
.
errors
).
to
include
(
error_mr_required
)
end
context
'when coupled with the `create` push option'
do
let
(
:push_options
)
{
{
create:
true
,
assign:
{
user2
.
id
=>
1
,
user3
.
id
=>
1
},
unassign:
{
user1
.
id
=>
1
,
user3
.
id
=>
1
}
}
}
it_behaves_like
'a service that can create a merge request'
it_behaves_like
'a service that can change one assignee of a merge request'
end
end
context
'with an existing branch that has a merge request open'
do
let
(
:changes
)
{
existing_branch_changes
}
let!
(
:merge_request
)
{
create
(
:merge_request
,
source_project:
project
,
source_branch:
source_branch
)}
it_behaves_like
'a service that does not create a merge request'
it_behaves_like
'a service that can change one assignee of a merge request'
end
context
'with a deleted branch'
do
let
(
:changes
)
{
deleted_branch_changes
}
it_behaves_like
'a service that does nothing'
end
context
'with the project default branch'
do
let
(
:changes
)
{
default_branch_changes
}
it_behaves_like
'a service that does nothing'
end
end
describe
'multiple pushed branches'
do
let
(
:push_options
)
{
{
create:
true
}
}
let
(
:changes
)
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