2020-05-29 17:08:35 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-24 14:09:03 -04:00
|
|
|
RSpec.describe AlertManagement::AlertAssignee do
|
2020-05-29 17:08:35 -04:00
|
|
|
describe 'associations' do
|
|
|
|
it { is_expected.to belong_to(:alert) }
|
|
|
|
it { is_expected.to belong_to(:assignee) }
|
|
|
|
end
|
|
|
|
|
|
|
|
describe 'validations' do
|
2020-06-09 17:08:21 -04:00
|
|
|
let(:alert) { create(:alert_management_alert) }
|
|
|
|
let(:user) { create(:user) }
|
|
|
|
|
|
|
|
subject { alert.alert_assignees.build(assignee: user) }
|
2020-05-29 17:08:35 -04:00
|
|
|
|
|
|
|
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
|