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
b0d7832c
Commit
b0d7832c
authored
Sep 16, 2020
by
Robert May
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expand tests and other tweaks
parent
3af2cb0e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
5 deletions
+24
-5
ee/app/services/ee/merge_requests/refresh_service.rb
ee/app/services/ee/merge_requests/refresh_service.rb
+0
-1
ee/spec/workers/merge_request_reset_approvals_worker_spec.rb
ee/spec/workers/merge_request_reset_approvals_worker_spec.rb
+24
-4
No files found.
ee/app/services/ee/merge_requests/refresh_service.rb
View file @
b0d7832c
...
@@ -18,7 +18,6 @@ module EE
...
@@ -18,7 +18,6 @@ module EE
reset_approvals_for_merge_requests
(
push
.
ref
,
push
.
newrev
)
reset_approvals_for_merge_requests
(
push
.
ref
,
push
.
newrev
)
end
end
# Note: Closed merge requests also need approvals reset.
def
reset_approvals_for_merge_requests
(
ref
,
newrev
)
def
reset_approvals_for_merge_requests
(
ref
,
newrev
)
MergeRequestResetApprovalsWorker
.
perform_async
(
project
.
id
,
current_user
.
id
,
ref
,
newrev
)
MergeRequestResetApprovalsWorker
.
perform_async
(
project
.
id
,
current_user
.
id
,
ref
,
newrev
)
end
end
...
...
ee/spec/workers/merge_request_reset_approvals_worker_spec.rb
View file @
b0d7832c
# frozen_string_literal: true
# frozen_string_literal: true
require
'spec_helper'
require
"spec_helper"
RSpec
.
describe
MergeRequestResetApprovalsWorker
do
RSpec
.
describe
MergeRequestResetApprovalsWorker
do
include
RepoHelpers
include
RepoHelpers
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
subject
{
described_class
.
new
}
subject
{
described_class
.
new
}
describe
'#perform'
do
describe
"#perform"
do
let
(
:newrev
)
{
"789012"
}
let
(
:newrev
)
{
"789012"
}
let
(
:ref
)
{
"refs/heads/test"
}
let
(
:ref
)
{
"refs/heads/test"
}
...
@@ -18,12 +18,32 @@ RSpec.describe MergeRequestResetApprovalsWorker do
...
@@ -18,12 +18,32 @@ RSpec.describe MergeRequestResetApprovalsWorker do
subject
.
perform
(
project
.
id
,
user
.
id
,
ref
,
newrev
)
subject
.
perform
(
project
.
id
,
user
.
id
,
ref
,
newrev
)
end
end
it
'executes MergeRequests::RefreshService with expected values'
do
it
"executes MergeRequests::RefreshService with expected values"
do
expect_next_instance_of
(
EE
::
MergeRequests
::
ResetApprovalsService
,
project
,
user
)
do
|
refresh_service
|
expect_next_instance_of
(
EE
::
MergeRequests
::
ResetApprovalsService
,
project
,
user
)
do
|
refresh_service
|
expect
(
refresh_service
).
to
receive
(
:execute
).
with
(
ref
,
newrev
)
expect
(
refresh_service
).
to
receive
(
:execute
).
with
(
ref
,
newrev
)
end
end
perform
perform
end
end
context
"project is missing"
do
let
(
:project
)
{
double
(
"project"
,
id:
"foo"
)
}
it
"doesn't execute the service"
do
expect
(
EE
::
MergeRequests
::
ResetApprovalsService
).
not_to
receive
(
:new
)
perform
end
end
context
"user is missing"
do
let
(
:user
)
{
double
(
"user"
,
id:
"foo"
)
}
it
"doesn't execute the service"
do
expect
(
EE
::
MergeRequests
::
ResetApprovalsService
).
not_to
receive
(
:new
)
perform
end
end
end
end
end
end
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