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-03-09 13:42:32 +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
|
|
|
|
label.priorities.create(project: label.project, priority: evaluator.priority)
|
|
|
|
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
|
|
|
|
end
|