Commit ade38e8f authored by Mark Chao's avatar Mark Chao

Inherit BaseProjectService for prometheus services

parent 3beb188e
......@@ -82,17 +82,17 @@ module Projects
def create_service
Projects::Prometheus::Alerts::CreateService
.new(project, current_user, alerts_params)
.new(project: project, current_user: current_user, params: alerts_params)
end
def update_service
Projects::Prometheus::Alerts::UpdateService
.new(project, current_user, alerts_params)
.new(project: project, current_user: current_user, params: alerts_params)
end
def destroy_service
Projects::Prometheus::Alerts::DestroyService
.new(project, current_user, nil)
.new(project: project, current_user: current_user, params: nil)
end
def schedule_prometheus_update!
......
......@@ -3,7 +3,7 @@
module Projects
module Prometheus
module Alerts
class CreateService < BaseService
class CreateService < BaseProjectService
include AlertParams
def execute
......
......@@ -3,7 +3,7 @@
module Projects
module Prometheus
module Alerts
class DestroyService < BaseService
class DestroyService < BaseProjectService
def execute(alert)
alert.destroy
end
......
......@@ -3,7 +3,7 @@
module Projects
module Prometheus
module Alerts
class UpdateService < BaseService
class UpdateService < BaseProjectService
include AlertParams
def execute(alert)
......
......@@ -6,7 +6,7 @@ RSpec.describe Projects::Prometheus::Alerts::CreateService do
let_it_be(:project) { create(:project) }
let_it_be(:user) { create(:user) }
let(:service) { described_class.new(project, user, params) }
let(:service) { described_class.new(project: project, current_user: user, params: params) }
subject { service.execute }
......
......@@ -7,7 +7,7 @@ RSpec.describe Projects::Prometheus::Alerts::DestroyService do
let_it_be(:user) { create(:user) }
let_it_be(:alert) { create(:prometheus_alert, project: project) }
let(:service) { described_class.new(project, user, nil) }
let(:service) { described_class.new(project: project, current_user: user, params: nil) }
describe '#execute' do
subject { service.execute(alert) }
......
......@@ -11,7 +11,7 @@ RSpec.describe Projects::Prometheus::Alerts::UpdateService do
create(:prometheus_alert, project: project, environment: environment)
end
let(:service) { described_class.new(project, user, params) }
let(:service) { described_class.new(project: project, current_user: user, params: params) }
let(:params) do
{
......
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