2020-04-22 19:07:51 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-07-28 23:09:34 +05:30
|
|
|
RSpec.describe PrometheusAlertEntity do
|
2023-03-04 22:38:38 +05:30
|
|
|
let(:user) { build_stubbed(:user) }
|
|
|
|
let(:prometheus_alert) { build_stubbed(:prometheus_alert) }
|
2020-04-22 19:07:51 +05:30
|
|
|
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)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'exposes prometheus_alert attributes' do
|
2020-10-24 23:57:45 +05:30
|
|
|
expect(subject).to include(:id, :title, :query, :operator, :threshold, :runbook_url)
|
2020-04-22 19:07:51 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|