summaryrefslogtreecommitdiff
path: root/spec/factories/labels.rb
blob: 5ba8443c62c7c51453a662fc64e251d5cadfbee6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
FactoryGirl.define do
  factory :label, class: ProjectLabel do
    sequence(:title) { |n| "label#{n}" }
    color "#990000"
    project factory: :empty_project

    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

  factory :group_label, class: GroupLabel do
    sequence(:title) { |n| "label#{n}" }
    color "#990000"
    group
  end
end