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
7af730a0
Commit
7af730a0
authored
Apr 22, 2020
by
Steffen Köhler
Committed by
Igor Drozdov
Apr 22, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix calculation of given approvals
parent
f62f3979
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
1 deletion
+17
-1
changelogs/unreleased/fix-approvals-given-count.yml
changelogs/unreleased/fix-approvals-given-count.yml
+5
-0
ee/app/models/concerns/approvable.rb
ee/app/models/concerns/approvable.rb
+1
-1
ee/spec/models/approvable_spec.rb
ee/spec/models/approvable_spec.rb
+11
-0
No files found.
changelogs/unreleased/fix-approvals-given-count.yml
0 → 100644
View file @
7af730a0
---
title
:
Fix number of approvals given calculation
merge_request
:
28293
author
:
Steffen Köhler
type
:
fixed
ee/app/models/concerns/approvable.rb
View file @
7af730a0
...
@@ -42,7 +42,7 @@ module Approvable
...
@@ -42,7 +42,7 @@ module Approvable
end
end
def
approvals_given
def
approvals_given
approvals
.
size
approvals
_required
-
approvals_left
end
end
def
approvals_before_merge
def
approvals_before_merge
...
...
ee/spec/models/approvable_spec.rb
View file @
7af730a0
...
@@ -27,6 +27,17 @@ describe Approvable do
...
@@ -27,6 +27,17 @@ describe Approvable do
end
end
end
end
describe
"#approvals_given"
do
subject
{
merge_request
.
approvals_given
}
it
"returns the correct number of approvals given"
do
approval_state
=
double
(
"approval_state"
,
approvals_required:
5
,
approvals_left:
3
)
allow
(
merge_request
).
to
receive
(
:approval_state
).
and_return
(
approval_state
)
expect
(
subject
).
to
eq
(
approval_state
.
approvals_required
-
approval_state
.
approvals_left
)
end
end
described_class
::
FORWARDABLE_METHODS
.
each
do
|
method
|
described_class
::
FORWARDABLE_METHODS
.
each
do
|
method
|
it
{
is_expected
.
to
delegate_method
(
method
).
to
(
:approval_state
)
}
it
{
is_expected
.
to
delegate_method
(
method
).
to
(
:approval_state
)
}
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