2017-12-13 19:13:44 -05:00
|
|
|
FactoryBot.define do
|
2016-02-16 22:55:24 -05:00
|
|
|
factory :issue do
|
2017-03-23 12:37:14 -04:00
|
|
|
title { generate(:title) }
|
2017-08-02 15:55:11 -04:00
|
|
|
project
|
2017-08-04 13:14:04 -04:00
|
|
|
author { project.creator }
|
2016-02-16 22:55:24 -05:00
|
|
|
|
2016-03-17 15:38:51 -04:00
|
|
|
trait :confidential do
|
|
|
|
confidential true
|
|
|
|
end
|
|
|
|
|
2017-04-25 06:36:18 -04:00
|
|
|
trait :opened do
|
|
|
|
state :opened
|
|
|
|
end
|
|
|
|
|
2016-02-16 22:55:24 -05:00
|
|
|
trait :closed do
|
|
|
|
state :closed
|
2017-09-19 11:25:42 -04:00
|
|
|
closed_at { Time.now }
|
2016-02-16 22:55:24 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
factory :closed_issue, traits: [:closed]
|
2017-07-19 10:03:50 -04:00
|
|
|
factory :reopened_issue, traits: [:opened]
|
2016-07-20 18:45:19 -04:00
|
|
|
|
|
|
|
factory :labeled_issue do
|
|
|
|
transient do
|
|
|
|
labels []
|
|
|
|
end
|
|
|
|
|
|
|
|
after(:create) do |issue, evaluator|
|
|
|
|
issue.update_attributes(labels: evaluator.labels)
|
|
|
|
end
|
|
|
|
end
|
2016-02-16 22:55:24 -05:00
|
|
|
end
|
|
|
|
end
|