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