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
154bbe3d
Commit
154bbe3d
authored
Jul 16, 2020
by
Tetiana Chupryna
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Properly check if license-check approved
parent
9e69466a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
3 deletions
+11
-3
ee/app/models/ee/merge_request.rb
ee/app/models/ee/merge_request.rb
+3
-1
ee/spec/models/merge_request_spec.rb
ee/spec/models/merge_request_spec.rb
+8
-2
No files found.
ee/app/models/ee/merge_request.rb
View file @
154bbe3d
...
...
@@ -245,7 +245,9 @@ module EE
private
def
has_approved_license_check?
approval_rules
.
license_compliance
.
last
&
.
approvals_required
==
0
if
rule
=
approval_rules
.
license_compliance
.
last
ApprovalWrappedRule
.
wrap
(
self
,
rule
).
approved?
end
end
def
missing_report_error
(
report_type
)
...
...
ee/spec/models/merge_request_spec.rb
View file @
154bbe3d
...
...
@@ -120,14 +120,20 @@ RSpec.describe MergeRequest do
end
context
'with License-Check enabled'
do
let!
(
:license_check
)
{
create
(
:report_approver_rule
,
:license_scanning
,
merge_request:
merge_request
)
}
context
'when rule is not approved'
do
let!
(
:license_check
)
{
create
(
:report_approver_rule
,
:license_scanning
,
merge_request:
merge_request
,
approvals_required:
1
)
}
before
do
allow_any_instance_of
(
ApprovalWrappedRule
).
to
receive
(
:approved?
).
and_return
(
false
)
end
it
{
is_expected
.
to
be_truthy
}
end
context
'when rule is approved'
do
let!
(
:license_check
)
{
create
(
:report_approver_rule
,
:license_scanning
,
merge_request:
merge_request
,
approvals_required:
0
)
}
before
do
allow_any_instance_of
(
ApprovalWrappedRule
).
to
receive
(
:approved?
).
and_return
(
true
)
end
it
{
is_expected
.
to
be_falsey
}
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