summaryrefslogtreecommitdiff
path: root/spec/models/alert_management/alert_assignee_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/models/alert_management/alert_assignee_spec.rb')
-rw-r--r--spec/models/alert_management/alert_assignee_spec.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/models/alert_management/alert_assignee_spec.rb b/spec/models/alert_management/alert_assignee_spec.rb
new file mode 100644
index 00000000000..c51a5d543ab
--- /dev/null
+++ b/spec/models/alert_management/alert_assignee_spec.rb
@@ -0,0 +1,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