Welcome to mirror list, hosted at ThFree Co, Russian Federation.

alert_spec.rb « data_builder « gitlab « lib « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 6c3dc3cd8b4acd6d673fafe7e034bd742f544632 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Gitlab::DataBuilder::Alert do
  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