2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
FactoryBot.define do
|
2016-06-02 11:05:42 +05:30
|
|
|
factory :issue do
|
2017-08-17 22:00:37 +05:30
|
|
|
title { generate(:title) }
|
2017-09-10 17:25:29 +05:30
|
|
|
project
|
2018-03-17 18:26:18 +05:30
|
|
|
author { project.creator }
|
2018-11-08 19:23:39 +05:30
|
|
|
updated_by { author }
|
2016-06-02 11:05:42 +05:30
|
|
|
|
|
|
|
trait :confidential do
|
|
|
|
confidential true
|
|
|
|
end
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
trait :opened do
|
|
|
|
state :opened
|
|
|
|
end
|
|
|
|
|
2018-12-05 23:21:45 +05:30
|
|
|
trait :locked do
|
|
|
|
discussion_locked true
|
|
|
|
end
|
|
|
|
|
2016-06-02 11:05:42 +05:30
|
|
|
trait :closed do
|
|
|
|
state :closed
|
2018-03-17 18:26:18 +05:30
|
|
|
closed_at { Time.now }
|
2016-06-02 11:05:42 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
factory :closed_issue, traits: [:closed]
|
2017-09-10 17:25:29 +05:30
|
|
|
factory :reopened_issue, traits: [:opened]
|
2016-09-13 17:45:13 +05:30
|
|
|
|
|
|
|
factory :labeled_issue do
|
|
|
|
transient do
|
|
|
|
labels []
|
|
|
|
end
|
|
|
|
|
|
|
|
after(:create) do |issue, evaluator|
|
2018-11-18 11:00:15 +05:30
|
|
|
issue.update(labels: evaluator.labels)
|
2016-09-13 17:45:13 +05:30
|
|
|
end
|
|
|
|
end
|
2016-06-02 11:05:42 +05:30
|
|
|
end
|
|
|
|
end
|