summaryrefslogtreecommitdiff
path: root/spec/models/error_tracking/error_spec.rb
blob: 57899985dafe20bdccaf9aceea5e3e3de513e647 (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
27
28
29
30
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe ErrorTracking::Error, type: :model do
  let_it_be(:error) { create(:error_tracking_error) }

  describe 'relationships' do
    it { is_expected.to belong_to(:project) }
    it { is_expected.to have_many(:events) }
  end

  describe 'validations' do
    it { is_expected.to validate_presence_of(:name) }
    it { is_expected.to validate_presence_of(:description) }
    it { is_expected.to validate_presence_of(:actor) }
  end

  describe '#title' do
    it { expect(error.title).to eq('ActionView::MissingTemplate Missing template posts/edit') }
  end

  describe '#to_sentry_error' do
    it { expect(error.to_sentry_error).to be_kind_of(Gitlab::ErrorTracking::Error) }
  end

  describe '#to_sentry_detailed_error' do
    it { expect(error.to_sentry_detailed_error).to be_kind_of(Gitlab::ErrorTracking::DetailedError) }
  end
end