Commit 140eb10d authored by Vitali Tatarintev's avatar Vitali Tatarintev

Move alerts_service_activated? into EE

Move `Project#alerts_service_activated?` method into EE namespace
parent f4450d9b
......@@ -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)
......
......@@ -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)
......
......@@ -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) }
......
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment