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
fb529556
Commit
fb529556
authored
Apr 22, 2021
by
Amit Patel
Committed by
Arturo Herrero
Apr 22, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add group_level? and instance_level? helpers to service.rb model
parent
280776b4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
0 deletions
+33
-0
app/models/service.rb
app/models/service.rb
+8
-0
changelogs/unreleased/326079-add-group-level-and-instance-level-helpers-to-service-model.yml
...oup-level-and-instance-level-helpers-to-service-model.yml
+5
-0
spec/models/service_spec.rb
spec/models/service_spec.rb
+20
-0
No files found.
app/models/service.rb
View file @
fb529556
...
...
@@ -416,6 +416,14 @@ class Service < ApplicationRecord
project_id
.
present?
end
def
group_level?
group_id
.
present?
end
def
instance_level?
instance?
end
def
parent
project
||
group
end
...
...
changelogs/unreleased/326079-add-group-level-and-instance-level-helpers-to-service-model.yml
0 → 100644
View file @
fb529556
---
title
:
Add group_level? and instance_level? helpers to Service model
merge_request
:
59838
author
:
Amit Patel @amit.savani
type
:
other
spec/models/service_spec.rb
View file @
fb529556
...
...
@@ -212,6 +212,26 @@ RSpec.describe Service do
end
end
describe
'#group_level?'
do
it
'is true when service has a group'
do
expect
(
build
(
:service
,
group:
group
)).
to
be_group_level
end
it
'is false when service has no group'
do
expect
(
build
(
:service
,
group:
nil
)).
not_to
be_group_level
end
end
describe
'#instance_level?'
do
it
'is true when service has instance-level integration'
do
expect
(
build
(
:service
,
:instance
)).
to
be_instance_level
end
it
'is false when service does not have instance-level integration'
do
expect
(
build
(
:service
,
instance:
false
)).
not_to
be_instance_level
end
end
describe
'.find_or_initialize_non_project_specific_integration'
do
let!
(
:service1
)
{
create
(
:jira_service
,
project_id:
nil
,
group_id:
group
.
id
)
}
let!
(
:service2
)
{
create
(
:jira_service
)
}
...
...
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