labels.rb 488 Bytes
Newer Older
1
FactoryGirl.define do
2
  factory :label, class: ProjectLabel do
3
    sequence(:title) { |n| "label#{n}" }
4 5
    color "#990000"
    project
6 7 8 9 10 11 12 13 14 15

    transient do
      priority nil
    end

    after(:create) do |label, evaluator|
      if evaluator.priority
        label.priorities.create(project: label.project, priority: evaluator.priority)
      end
    end
16
  end
17 18 19 20 21 22

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