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
0fde217b
Commit
0fde217b
authored
Jun 13, 2017
by
Adam Niedzielski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix approval spec for project with only one member
parent
d6be61f3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
21 deletions
+3
-21
spec/models/merge_request_spec.rb
spec/models/merge_request_spec.rb
+3
-21
No files found.
spec/models/merge_request_spec.rb
View file @
0fde217b
...
...
@@ -1510,17 +1510,18 @@ describe MergeRequest, models: true do
let
(
:approver
)
{
create
(
:user
)
}
context
'on a project with only one member'
do
let
(
:author
)
{
project
.
owner
}
context
'when there is one approver'
do
before
{
project
.
update_attributes
(
approvals_before_merge:
1
)
}
context
'when that approver is the MR author'
do
before
do
project
.
team
<<
[
author
,
:developer
]
create
(
:approver
,
user:
author
,
target:
merge_request
)
end
it
'does not require approval for the merge request'
do
expect
(
merge_request
.
approvals_left
).
to
eq
(
1
)
expect
(
merge_request
.
approvals_left
).
to
eq
(
0
)
end
it
'does not allow the approver to approve the MR'
do
...
...
@@ -1531,25 +1532,6 @@ describe MergeRequest, models: true do
expect
(
merge_request
.
can_approve?
(
nil
)).
to
be_falsey
end
end
context
'when that approver is not the MR author'
do
before
do
project
.
team
<<
[
approver
,
:developer
]
create
(
:approver
,
user:
approver
,
target:
merge_request
)
end
it
'requires one approval'
do
expect
(
merge_request
.
approvals_left
).
to
eq
(
1
)
end
it
'allows the approver to approve the MR'
do
expect
(
merge_request
.
can_approve?
(
approver
)).
to
be_truthy
end
it
'does not allow a logged-out user to approve the MR'
do
expect
(
merge_request
.
can_approve?
(
nil
)).
to
be_falsey
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