2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
FactoryBot.define do
|
2017-08-17 22:00:37 +05:30
|
|
|
trait :base_label do
|
|
|
|
title { generate(:label_title) }
|
2019-12-21 20:55:43 +05:30
|
|
|
color { "#990000" }
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
trait :described do
|
|
|
|
description { "Description of #{title}" }
|
|
|
|
end
|
|
|
|
|
|
|
|
trait :scoped do
|
|
|
|
transient do
|
|
|
|
prefix { 'scope' }
|
|
|
|
end
|
|
|
|
|
|
|
|
title { "#{prefix}::#{generate(:label_title)}" }
|
|
|
|
end
|
|
|
|
|
2020-03-13 15:44:24 +05:30
|
|
|
factory :label, traits: [:base_label], class: 'ProjectLabel' do
|
2017-09-10 17:25:29 +05:30
|
|
|
project
|
2016-11-03 12:29:30 +05:30
|
|
|
|
|
|
|
transient do
|
2019-12-21 20:55:43 +05:30
|
|
|
priority { nil }
|
2016-11-03 12:29:30 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
after(:create) do |label, evaluator|
|
|
|
|
if evaluator.priority
|
2020-10-24 23:57:45 +05:30
|
|
|
label.priorities.create!(project: label.project, priority: evaluator.priority)
|
2016-11-03 12:29:30 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
factory :group_label, traits: [:base_label] do
|
2016-11-03 12:29:30 +05:30
|
|
|
group
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
2022-03-02 08:16:31 +05:30
|
|
|
|
|
|
|
factory :admin_label, traits: [:base_label], class: 'Label'
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|