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:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-04-07 18:09:30 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-04-07 18:09:30 +0300
commitc6b3ec3f56fa32a0e0ed3de0d0878d25f1adaddf (patch)
tree967afee9a510ff9dd503ebd83706dc760ec2e3ed /spec/controllers
parent903ccf7c93eb9490c76857bffe744249cc07de09 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/controllers')
-rw-r--r--spec/controllers/projects/alerting/notifications_controller_spec.rb2
-rw-r--r--spec/controllers/projects/prometheus/alerts_controller_spec.rb9
2 files changed, 7 insertions, 4 deletions
diff --git a/spec/controllers/projects/alerting/notifications_controller_spec.rb b/spec/controllers/projects/alerting/notifications_controller_spec.rb
index a56ac59215f..9d26c2278b1 100644
--- a/spec/controllers/projects/alerting/notifications_controller_spec.rb
+++ b/spec/controllers/projects/alerting/notifications_controller_spec.rb
@@ -48,7 +48,7 @@ describe Projects::Alerting::NotificationsController do
end
context 'when notification service fails' do
- let(:service_response) { ServiceResponse.error(message: 'Unauthorized', http_status: 401) }
+ let(:service_response) { ServiceResponse.error(message: 'Unauthorized', http_status: :unauthorized) }
it 'responds with the service response' do
make_request
diff --git a/spec/controllers/projects/prometheus/alerts_controller_spec.rb b/spec/controllers/projects/prometheus/alerts_controller_spec.rb
index e215f4b68fa..451834e0962 100644
--- a/spec/controllers/projects/prometheus/alerts_controller_spec.rb
+++ b/spec/controllers/projects/prometheus/alerts_controller_spec.rb
@@ -158,7 +158,8 @@ describe Projects::Prometheus::AlertsController do
end
describe 'POST #notify' do
- let(:notify_service) { spy }
+ let(:service_response) { ServiceResponse.success }
+ let(:notify_service) { instance_double(Projects::Prometheus::Alerts::NotifyService, execute: service_response) }
before do
sign_out(user)
@@ -170,7 +171,7 @@ describe Projects::Prometheus::AlertsController do
end
it 'returns ok if notification succeeds' do
- expect(notify_service).to receive(:execute).and_return(true)
+ expect(notify_service).to receive(:execute).and_return(ServiceResponse.success)
post :notify, params: project_params, session: { as: :json }
@@ -178,7 +179,9 @@ describe Projects::Prometheus::AlertsController do
end
it 'returns unprocessable entity if notification fails' do
- expect(notify_service).to receive(:execute).and_return(false)
+ expect(notify_service).to receive(:execute).and_return(
+ ServiceResponse.error(message: 'Unprocessable Entity', http_status: :unprocessable_entity)
+ )
post :notify, params: project_params, session: { as: :json }