diff options
Diffstat (limited to 'spec/controllers/projects/alerting/notifications_controller_spec.rb')
-rw-r--r-- | spec/controllers/projects/alerting/notifications_controller_spec.rb | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/spec/controllers/projects/alerting/notifications_controller_spec.rb b/spec/controllers/projects/alerting/notifications_controller_spec.rb index 2fff8026b22..b3feeb7c07b 100644 --- a/spec/controllers/projects/alerting/notifications_controller_spec.rb +++ b/spec/controllers/projects/alerting/notifications_controller_spec.rb @@ -16,7 +16,9 @@ RSpec.describe Projects::Alerting::NotificationsController do end shared_examples 'process alert payload' do |notify_service_class| - let(:service_response) { ServiceResponse.success } + let(:alert_1) { build(:alert_management_alert, project: project) } + let(:alert_2) { build(:alert_management_alert, project: project) } + let(:service_response) { ServiceResponse.success(payload: { alerts: [alert_1, alert_2] }) } let(:notify_service) { instance_double(notify_service_class, execute: service_response) } before do @@ -30,9 +32,13 @@ RSpec.describe Projects::Alerting::NotificationsController do context 'when notification service succeeds' do let(:permitted_params) { ActionController::Parameters.new(payload).permit! } - it 'responds with ok' do + it 'responds with the alert data' do make_request + expect(json_response).to contain_exactly( + { 'iid' => alert_1.iid, 'title' => alert_1.title }, + { 'iid' => alert_2.iid, 'title' => alert_2.title } + ) expect(response).to have_gitlab_http_status(:ok) end |