debian-mirror-gitlab/spec/factories/labels.rb

25 lines
480 B
Ruby
Raw Normal View History

2014-09-02 18:07:02 +05:30
FactoryGirl.define do
2017-08-17 22:00:37 +05:30
trait :base_label do
title { generate(:label_title) }
2014-09-02 18:07:02 +05:30
color "#990000"
2017-08-17 22:00:37 +05:30
end
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
priority nil
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