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