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:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-06-02 12:09:17 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-06-02 12:09:17 +0300
commit9cd5033338348e41c06b09211161a32ed9a8b18a (patch)
tree8b7882b6b6ae2cf9fa5c2b1f65bcbedd3729cfdc /spec/factories
parent4ea9f70a2f4833a1063ddc173a285929d9b3b25c (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/factories')
-rw-r--r--spec/factories/work_items.rb5
-rw-r--r--spec/factories/work_items/parent_links.rb21
2 files changed, 26 insertions, 0 deletions
diff --git a/spec/factories/work_items.rb b/spec/factories/work_items.rb
index 6d9dcac6165..e80aa9cc008 100644
--- a/spec/factories/work_items.rb
+++ b/spec/factories/work_items.rb
@@ -9,5 +9,10 @@ FactoryBot.define do
relative_position { RelativePositioning::START_POSITION }
issue_type { :issue }
association :work_item_type, :default
+
+ trait :task do
+ issue_type { :task }
+ association :work_item_type, :default, :task
+ end
end
end
diff --git a/spec/factories/work_items/parent_links.rb b/spec/factories/work_items/parent_links.rb
new file mode 100644
index 00000000000..886aa449a57
--- /dev/null
+++ b/spec/factories/work_items/parent_links.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+FactoryBot.define do
+ factory :parent_link, class: 'WorkItems::ParentLink' do
+ transient do
+ work_item { nil }
+ work_item_parent { nil }
+ end
+
+ after(:build) do |link, evaluator|
+ link.work_item = evaluator.work_item
+ link.work_item_parent = evaluator.work_item_parent
+
+ unless link.work_item && link.work_item_parent
+ project = link.work_item&.project || link.work_item_parent&.project || create(:project)
+ link.work_item ||= create(:work_item, :task, project: project)
+ link.work_item_parent ||= create(:work_item, project: project)
+ end
+ end
+ end
+end