2020-03-23 08:09:47 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-24 02:09:01 -04:00
|
|
|
RSpec.describe PrometheusAlertEntity do
|
2020-03-23 08:09:47 -04:00
|
|
|
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)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'exposes prometheus_alert attributes' do
|
2020-08-07 02:09:47 -04:00
|
|
|
expect(subject).to include(:id, :title, :query, :operator, :threshold, :runbook_url)
|
2020-03-23 08:09:47 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|