diff options
Diffstat (limited to 'spec/models/alert_management')
-rw-r--r-- | spec/models/alert_management/alert_spec.rb | 11 | ||||
-rw-r--r-- | spec/models/alert_management/metric_image_spec.rb | 8 |
2 files changed, 11 insertions, 8 deletions
diff --git a/spec/models/alert_management/alert_spec.rb b/spec/models/alert_management/alert_spec.rb index 40bdfd4bc92..685ed81ec84 100644 --- a/spec/models/alert_management/alert_spec.rb +++ b/spec/models/alert_management/alert_spec.rb @@ -233,6 +233,17 @@ RSpec.describe AlertManagement::Alert do end end + describe '.find_unresolved_alert' do + let_it_be(:fingerprint) { SecureRandom.hex } + let_it_be(:resolved_alert_with_fingerprint) { create(:alert_management_alert, :resolved, project: project, fingerprint: fingerprint) } + let_it_be(:alert_with_fingerprint_in_other_project) { create(:alert_management_alert, project: project2, fingerprint: fingerprint) } + let_it_be(:alert_with_fingerprint) { create(:alert_management_alert, project: project, fingerprint: fingerprint) } + + subject { described_class.find_unresolved_alert(project, fingerprint) } + + it { is_expected.to eq(alert_with_fingerprint) } + end + describe '.last_prometheus_alert_by_project_id' do subject { described_class.last_prometheus_alert_by_project_id } diff --git a/spec/models/alert_management/metric_image_spec.rb b/spec/models/alert_management/metric_image_spec.rb index dedbd6e501e..ca910474423 100644 --- a/spec/models/alert_management/metric_image_spec.rb +++ b/spec/models/alert_management/metric_image_spec.rb @@ -15,12 +15,4 @@ RSpec.describe AlertManagement::MetricImage do it { is_expected.to validate_length_of(:url).is_at_most(255) } it { is_expected.to validate_length_of(:url_text).is_at_most(128) } end - - describe '.available_for?' do - subject { described_class.available_for?(issue.project) } - - let_it_be_with_refind(:issue) { create(:issue) } - - it { is_expected.to eq(true) } - end end |