BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
9ab02540
Commit
9ab02540
authored
Oct 11, 2017
by
Oswaldo Ferreira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make "merge ongoing" check more consistent
parent
efeaf3bd
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
2 deletions
+27
-2
merge_request.rb
app/models/merge_request.rb
+1
-1
39032-improve-merge-ongoing-check-consistency.yml
...eleased/39032-improve-merge-ongoing-check-consistency.yml
+5
-0
merge_request_spec.rb
spec/models/merge_request_spec.rb
+21
-1
No files found.
app/models/merge_request.rb
View file @
9ab02540
...
...
@@ -396,7 +396,7 @@ class MergeRequest < ActiveRecord::Base
end
def
merge_ongoing?
!!
merge_jid
&&
!
merged?
!!
merge_jid
&&
!
merged?
&&
Gitlab
::
SidekiqStatus
.
num_running
([
merge_jid
])
>
0
end
def
closed_without_fork?
...
...
changelogs/unreleased/39032-improve-merge-ongoing-check-consistency.yml
0 → 100644
View file @
9ab02540
---
title
:
Make "merge ongoing" check more consistent
merge_request
:
author
:
type
:
fixed
spec/models/merge_request_spec.rb
View file @
9ab02540
...
...
@@ -1460,11 +1460,31 @@ describe MergeRequest do
end
describe
'#merge_ongoing?'
do
it
'returns true when merge_id
is present and MR is not merged
'
do
it
'returns true when merge_id
, MR is not merged and it has no running job
'
do
merge_request
=
build_stubbed
(
:merge_request
,
state: :open
,
merge_jid:
'foo'
)
allow
(
Gitlab
::
SidekiqStatus
).
to
receive
(
:num_running
).
with
([
'foo'
])
{
1
}
expect
(
merge_request
.
merge_ongoing?
).
to
be
(
true
)
end
it
'returns false when merge_jid is nil'
do
merge_request
=
build_stubbed
(
:merge_request
,
state: :open
,
merge_jid:
nil
)
expect
(
merge_request
.
merge_ongoing?
).
to
be
(
false
)
end
it
'returns false if MR is merged'
do
merge_request
=
build_stubbed
(
:merge_request
,
state: :merged
,
merge_jid:
'foo'
)
expect
(
merge_request
.
merge_ongoing?
).
to
be
(
false
)
end
it
'returns false if there is no merge job running'
do
merge_request
=
build_stubbed
(
:merge_request
,
state: :open
,
merge_jid:
'foo'
)
allow
(
Gitlab
::
SidekiqStatus
).
to
receive
(
:num_running
).
with
([
'foo'
])
{
0
}
expect
(
merge_request
.
merge_ongoing?
).
to
be
(
false
)
end
end
describe
"#closed_without_fork?"
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