summaryrefslogtreecommitdiff
path: root/spec/serializers
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-23 12:09:47 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-23 12:09:47 +0000
commit8f9beefac3774b30e911fb00a68f4c7a5244cf27 (patch)
tree919c3a043f8c10bc3f78f3f6e029acfb6b972556 /spec/serializers
parente4bf776a8829e5186a0f63603c0be627b891d80e (diff)
downloadgitlab-ce-8f9beefac3774b30e911fb00a68f4c7a5244cf27.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/serializers')
-rw-r--r--spec/serializers/prometheus_alert_entity_spec.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/serializers/prometheus_alert_entity_spec.rb b/spec/serializers/prometheus_alert_entity_spec.rb
new file mode 100644
index 00000000000..5121c62a0e0
--- /dev/null
+++ b/spec/serializers/prometheus_alert_entity_spec.rb
@@ -0,0 +1,27 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe PrometheusAlertEntity do
+ let(:user) { create(:user) }
+ let(:prometheus_alert) { create(:prometheus_alert) }
+ let(:request) { double('prometheus_alert', current_user: user) }
+ let(:entity) { described_class.new(prometheus_alert, request: request) }
+
+ subject { entity.as_json }
+
+ context 'when user can read prometheus alerts' do
+ before do
+ prometheus_alert.project.add_maintainer(user)
+ stub_licensed_features(prometheus_alerts: true)
+ end
+
+ it 'exposes prometheus_alert attributes' do
+ expect(subject).to include(:id, :title, :query, :operator, :threshold)
+ end
+
+ it 'exposes alert_path' do
+ expect(subject).to include(:alert_path)
+ end
+ end
+end