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-06-02 20:08:38 -04: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 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
|
2020-07-21 08:09:30 -04:00
|
|
|
label.priorities.create!(project: label.project, priority: evaluator.priority)
|
2016-10-14 19:06:26 -04:00
|
|
|
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
|