Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/controllers/projects/prometheus/alerts_controller_spec.rb')
-rw-r--r--spec/controllers/projects/prometheus/alerts_controller_spec.rb11
1 files changed, 3 insertions, 8 deletions
diff --git a/spec/controllers/projects/prometheus/alerts_controller_spec.rb b/spec/controllers/projects/prometheus/alerts_controller_spec.rb
index 2c2c8180143..09b9f25c0c6 100644
--- a/spec/controllers/projects/prometheus/alerts_controller_spec.rb
+++ b/spec/controllers/projects/prometheus/alerts_controller_spec.rb
@@ -56,7 +56,7 @@ RSpec.describe Projects::Prometheus::AlertsController do
describe 'POST #notify' do
let(:alert_1) { build(:alert_management_alert, :prometheus, project: project) }
let(:alert_2) { build(:alert_management_alert, :prometheus, project: project) }
- let(:service_response) { ServiceResponse.success(payload: { alerts: [alert_1, alert_2] }) }
+ let(:service_response) { ServiceResponse.success(http_status: :created) }
let(:notify_service) { instance_double(Projects::Prometheus::Alerts::NotifyService, execute: service_response) }
before do
@@ -68,17 +68,12 @@ RSpec.describe Projects::Prometheus::AlertsController do
.and_return(notify_service)
end
- it 'returns ok if notification succeeds' do
+ it 'returns created if notification succeeds' do
expect(notify_service).to receive(:execute).and_return(service_response)
post :notify, params: project_params, session: { as: :json }
- 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)
+ expect(response).to have_gitlab_http_status(:created)
end
it 'returns unprocessable entity if notification fails' do