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
094128a5
Commit
094128a5
authored
Feb 15, 2021
by
Kerri Miller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace delegated predicate methods with boolean-returning methods
parent
798dd96d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
1 deletion
+54
-1
ee/app/models/ee/project.rb
ee/app/models/ee/project.rb
+12
-1
ee/spec/models/project_spec.rb
ee/spec/models/project_spec.rb
+42
-0
No files found.
ee/app/models/ee/project.rb
View file @
094128a5
...
...
@@ -200,7 +200,6 @@ module EE
delegate
:auto_rollback_enabled
,
:auto_rollback_enabled
=
,
:auto_rollback_enabled?
,
to: :ci_cd_settings
delegate
:closest_gitlab_subscription
,
to: :namespace
delegate
:jira_vulnerabilities_integration_enabled?
,
:configured_to_create_issues_from_vulnerabilities?
,
to: :jira_service
,
allow_nil:
true
delegate
:requirements_access_level
,
:security_and_compliance_access_level
,
to: :project_feature
,
allow_nil:
true
delegate
:pipeline_configuration_full_path
,
to: :compliance_management_framework
,
allow_nil:
true
...
...
@@ -239,6 +238,18 @@ module EE
::
Feature
.
enabled?
(
:jira_issue_association_on_merge_request
,
self
)
&&
feature_available?
(
:jira_issue_association_enforcement
)
end
def
jira_vulnerabilities_integration_enabled?
return
false
unless
jira_service
jira_service
.
jira_vulnerabilities_integration_enabled?
end
def
configured_to_create_issues_from_vulnerabilities?
return
false
unless
jira_service
jira_service
.
configured_to_create_issues_from_vulnerabilities?
end
end
class_methods
do
...
...
ee/spec/models/project_spec.rb
View file @
094128a5
...
...
@@ -59,6 +59,48 @@ RSpec.describe Project do
it
{
is_expected
.
to
have_many
(
:incident_management_oncall_schedules
).
class_name
(
'IncidentManagement::OncallSchedule'
)
}
it
{
is_expected
.
to
have_many
(
:incident_management_oncall_rotations
).
through
(
:incident_management_oncall_schedules
).
source
(
:rotations
)
}
describe
'#jira_vulnerabilities_integration_enabled?'
do
context
'when project lacks a jira_service relation'
do
it
'returns false'
do
expect
(
project
.
jira_vulnerabilities_integration_enabled?
).
to
be_falsey
end
end
context
'when project has a jira_service relation'
do
before
do
create
(
:jira_service
,
project:
project
)
end
it
'accesses the value from the jira_service'
do
expect
(
project
.
jira_service
)
.
to
receive
(
:jira_vulnerabilities_integration_enabled?
)
project
.
jira_vulnerabilities_integration_enabled?
end
end
end
describe
'#configured_to_create_issues_from_vulnerabilities?'
do
context
'when project lacks a jira_service relation'
do
it
'returns false'
do
expect
(
project
.
configured_to_create_issues_from_vulnerabilities?
).
to
be_falsey
end
end
context
'when project has a jira_service relation'
do
before
do
create
(
:jira_service
,
project:
project
)
end
it
'accesses the value from the jira_service'
do
expect
(
project
.
jira_service
)
.
to
receive
(
:configured_to_create_issues_from_vulnerabilities?
)
project
.
configured_to_create_issues_from_vulnerabilities?
end
end
end
describe
'#jira_issue_association_required_to_merge_enabled?'
do
using
RSpec
::
Parameterized
::
TableSyntax
...
...
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