summaryrefslogtreecommitdiff
path: root/spec/models/alert_management/alert_assignee_spec.rb
blob: c51a5d543ab56f94fba6c01e2d347a9b95c8a053 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# frozen_string_literal: true

require 'spec_helper'

describe AlertManagement::AlertAssignee do
  describe 'associations' do
    it { is_expected.to belong_to(:alert) }
    it { is_expected.to belong_to(:assignee) }
  end

  describe 'validations' do
    let(:alert) { create(:alert_management_alert) }
    let(:user) { create(:user) }

    subject { alert.alert_assignees.build(assignee: user) }

    it { is_expected.to validate_presence_of(:alert) }
    it { is_expected.to validate_presence_of(:assignee) }
    it { is_expected.to validate_uniqueness_of(:assignee).scoped_to(:alert_id) }
  end
end