debian-mirror-gitlab/spec/lib/gitlab/data_builder/alert_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

27 lines
979 B
Ruby
Raw Permalink Normal View History

2020-06-23 00:09:42 +05:30
# frozen_string_literal: true
require 'spec_helper'
2020-07-28 23:09:34 +05:30
RSpec.describe Gitlab::DataBuilder::Alert do
2020-06-23 00:09:42 +05:30
let_it_be(:project) { create(:project) }
let_it_be(:alert) { create(:alert_management_alert, project: project) }
describe '.build' do
let_it_be(:data) { described_class.build(alert) }
it { expect(data).to be_a(Hash) }
it { expect(data[:object_kind]).to eq('alert') }
it 'contains the correct object attributes', :aggregate_failures do
object_attributes = data[:object_attributes]
expect(object_attributes[:title]).to eq(alert.title)
expect(object_attributes[:url]).to eq(Gitlab::Routing.url_helpers.details_project_alert_management_url(project, alert.iid))
expect(object_attributes[:severity]).to eq(alert.severity)
expect(object_attributes[:events]).to eq(alert.events)
expect(object_attributes[:status]).to eq(alert.status_name)
expect(object_attributes[:started_at]).to eq(alert.started_at)
end
end
end