blob: a9a9416c48bb7bb8fa7f313b63e2753ce8b287cc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
# frozen_string_literal: true
FactoryBot.define do
trait :base_label do
title { generate(:label_title) }
color { "#990000" }
end
trait :described do
description { "Description of #{title}" }
end
trait :scoped do
transient do
prefix { 'scope' }
end
title { "#{prefix}::#{generate(:label_title)}" }
end
trait :incident do
properties = IncidentManagement::CreateIncidentLabelService::LABEL_PROPERTIES
title { properties.fetch(:title) }
description { properties.fetch(:description) }
color { properties.fetch(:color) }
end
factory :label, traits: [:base_label], class: 'ProjectLabel' do
project
transient do
priority { nil }
end
after(:create) do |label, evaluator|
if evaluator.priority
label.priorities.create!(project: label.project, priority: evaluator.priority)
end
end
end
factory :group_label, traits: [:base_label] do
group
end
end
|