diff options
Diffstat (limited to 'spec/services/projects/prometheus/alerts/notify_service_spec.rb')
-rw-r--r-- | spec/services/projects/prometheus/alerts/notify_service_spec.rb | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/spec/services/projects/prometheus/alerts/notify_service_spec.rb b/spec/services/projects/prometheus/alerts/notify_service_spec.rb index 0e5ac7c69e3..8ae47ec266c 100644 --- a/spec/services/projects/prometheus/alerts/notify_service_spec.rb +++ b/spec/services/projects/prometheus/alerts/notify_service_spec.rb @@ -7,7 +7,7 @@ RSpec.describe Projects::Prometheus::Alerts::NotifyService do let_it_be(:project, reload: true) { create(:project) } - let(:service) { described_class.new(project, nil, payload) } + let(:service) { described_class.new(project, payload) } let(:token_input) { 'token' } let!(:setting) do @@ -138,10 +138,10 @@ RSpec.describe Projects::Prometheus::Alerts::NotifyService do end end - context 'with generic alerts integration' do + context 'with HTTP integration' do using RSpec::Parameterized::TableSyntax - where(:alerts_service, :token, :result) do + where(:active, :token, :result) do :active | :valid | :success :active | :invalid | :failure :active | nil | :failure @@ -150,15 +150,12 @@ RSpec.describe Projects::Prometheus::Alerts::NotifyService do end with_them do - let(:valid) { project.alerts_service.token } + let(:valid) { integration.token } let(:invalid) { 'invalid token' } let(:token_input) { public_send(token) if token } + let(:integration) { create(:alert_management_http_integration, active, project: project) if active } - before do - if alerts_service - create(:alerts_service, alerts_service, project: project) - end - end + let(:subject) { service.execute(token_input, integration) } case result = params[:result] when :success @@ -221,7 +218,7 @@ RSpec.describe Projects::Prometheus::Alerts::NotifyService do it 'processes Prometheus alerts' do expect(AlertManagement::ProcessPrometheusAlertService) .to receive(:new) - .with(project, nil, kind_of(Hash)) + .with(project, kind_of(Hash)) .exactly(3).times .and_return(process_service) expect(process_service).to receive(:execute).exactly(3).times |