diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-18 11:18:50 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-18 11:18:50 +0000 |
commit | 8c7f4e9d5f36cff46365a7f8c4b9c21578c1e781 (patch) | |
tree | a77e7fe7a93de11213032ed4ab1f33a3db51b738 /spec/models/alert_management/alert_spec.rb | |
parent | 00b35af3db1abfe813a778f643dad221aad51fca (diff) | |
download | gitlab-ce-8c7f4e9d5f36cff46365a7f8c4b9c21578c1e781.tar.gz |
Add latest changes from gitlab-org/gitlab@13-1-stable-ee
Diffstat (limited to 'spec/models/alert_management/alert_spec.rb')
-rw-r--r-- | spec/models/alert_management/alert_spec.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/models/alert_management/alert_spec.rb b/spec/models/alert_management/alert_spec.rb index 1da0c6d4071..27b8bb48073 100644 --- a/spec/models/alert_management/alert_spec.rb +++ b/spec/models/alert_management/alert_spec.rb @@ -6,6 +6,10 @@ describe AlertManagement::Alert do describe 'associations' do it { is_expected.to belong_to(:project) } it { is_expected.to belong_to(:issue) } + it { is_expected.to have_many(:assignees).through(:alert_assignees) } + it { is_expected.to have_many(:notes) } + it { is_expected.to have_many(:ordered_notes) } + it { is_expected.to have_many(:user_mentions) } end describe 'validations' do @@ -241,6 +245,12 @@ describe AlertManagement::Alert do end end + describe '#to_reference' do + let(:alert) { build(:alert_management_alert) } + + it { expect(alert.to_reference).to eq('') } + end + describe '#trigger' do subject { alert.trigger } @@ -317,4 +327,14 @@ describe AlertManagement::Alert do expect { subject }.to change { alert.reload.ended_at }.to nil end end + + describe '#register_new_event!' do + subject { alert.register_new_event! } + + let(:alert) { create(:alert_management_alert) } + + it 'increments the events count by 1' do + expect { subject }.to change { alert.events }.by(1) + end + end end |