Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/factories/alert_management/alerts.rb')
-rw-r--r--spec/factories/alert_management/alerts.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/factories/alert_management/alerts.rb b/spec/factories/alert_management/alerts.rb
index 01f40a7a465..8724a626d77 100644
--- a/spec/factories/alert_management/alerts.rb
+++ b/spec/factories/alert_management/alerts.rb
@@ -8,10 +8,23 @@ FactoryBot.define do
title { FFaker::Lorem.sentence }
started_at { Time.current }
+ trait :with_validation_errors do
+ after(:create) do |alert|
+ too_many_hosts = Array.new(AlertManagement::Alert::HOSTS_MAX_LENGTH + 1) { |_| 'host' }
+ alert.update_columns(hosts: too_many_hosts)
+ end
+ end
+
trait :with_issue do
issue
end
+ trait :with_assignee do |alert|
+ after(:create) do |alert|
+ alert.alert_assignees.create(assignee: create(:user))
+ end
+ end
+
trait :with_fingerprint do
fingerprint { SecureRandom.hex }
end
@@ -70,6 +83,7 @@ FactoryBot.define do
trait :all_fields do
with_issue
+ with_assignee
with_fingerprint
with_service
with_monitoring_tool