labels.rb 504 Bytes
Newer Older
1
FactoryGirl.define do
2
3
  trait :base_label do
    title { generate(:label_title) }
4
    color "#990000"
5
6
7
  end

  factory :label, traits: [:base_label], class: ProjectLabel do
8
    project factory: :empty_project
9
10
11
12
13
14
15
16
17
18

    transient do
      priority nil
    end

    after(:create) do |label, evaluator|
      if evaluator.priority
        label.priorities.create(project: label.project, priority: evaluator.priority)
      end
    end
19
  end
20

21
  factory :group_label, traits: [:base_label] do
22
23
    group
  end
24
end