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
140eb10d
Commit
140eb10d
authored
Oct 25, 2019
by
Vitali Tatarintev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move alerts_service_activated? into EE
Move `Project#alerts_service_activated?` method into EE namespace
parent
f4450d9b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
40 deletions
+40
-40
app/models/project.rb
app/models/project.rb
+0
-4
ee/app/models/ee/project.rb
ee/app/models/ee/project.rb
+4
-0
ee/spec/models/project_spec.rb
ee/spec/models/project_spec.rb
+36
-0
spec/models/project_spec.rb
spec/models/project_spec.rb
+0
-36
No files found.
app/models/project.rb
View file @
140eb10d
...
...
@@ -2286,10 +2286,6 @@ class Project < ApplicationRecord
end
end
def
alerts_service_activated?
feature_available?
(
:incident_management
)
&&
alerts_service
.
try
(
:active?
)
end
private
def
closest_namespace_setting
(
name
)
...
...
ee/app/models/ee/project.rb
View file @
140eb10d
...
...
@@ -643,6 +643,10 @@ module EE
feature_available?
(
:incident_management
)
end
def
alerts_service_activated?
alerts_service_available?
&&
alerts_service
.
try
(
:active?
)
end
def
package_already_taken?
(
package_name
)
namespace
.
root_ancestor
.
all_projects
.
joins
(
:packages
)
...
...
ee/spec/models/project_spec.rb
View file @
140eb10d
...
...
@@ -1107,6 +1107,42 @@ describe Project do
end
end
describe
'#alerts_service_activated?'
do
let!
(
:project
)
{
create
(
:project
)
}
subject
{
project
.
alerts_service_activated?
}
context
'when incident management feature available'
do
before
do
stub_licensed_features
(
incident_management:
true
)
end
context
'when project has an activated alerts service'
do
before
do
create
(
:alerts_service
,
project:
project
)
end
it
{
is_expected
.
to
be_truthy
}
end
context
'when project has an inactive alerts service'
do
before
do
create
(
:alerts_service
,
:inactive
,
project:
project
)
end
it
{
is_expected
.
to
be_falsey
}
end
end
context
'when incident feature is not available'
do
before
do
stub_licensed_features
(
incident_management:
false
)
end
it
{
is_expected
.
to
be_falsey
}
end
end
describe
'#disabled_services'
do
let
(
:project
)
{
build
(
:project
)
}
...
...
spec/models/project_spec.rb
View file @
140eb10d
...
...
@@ -5329,42 +5329,6 @@ describe Project do
end
end
describe
'#alerts_service_activated?'
do
let!
(
:project
)
{
create
(
:project
)
}
subject
{
project
.
alerts_service_activated?
}
context
'when incident management feature available'
do
before
do
stub_licensed_features
(
incident_management:
true
)
end
context
'when project has an activated alerts service'
do
before
do
create
(
:alerts_service
,
project:
project
)
end
it
{
is_expected
.
to
be_truthy
}
end
context
'when project has an inactive alerts service'
do
before
do
create
(
:alerts_service
,
:inactive
,
project:
project
)
end
it
{
is_expected
.
to
be_falsey
}
end
end
context
'when incident feature is not available'
do
before
do
stub_licensed_features
(
incident_management:
false
)
end
it
{
is_expected
.
to
be_falsey
}
end
end
def
rugged_config
rugged_repo
(
project
.
repository
).
config
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