2019-07-25 05:11:48 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-12-14 00:13:44 +00:00
|
|
|
FactoryBot.define do
|
2016-07-27 21:46:03 +00:00
|
|
|
factory :board do
|
2018-02-19 19:06:16 +00:00
|
|
|
transient do
|
2019-10-02 00:06:26 +00:00
|
|
|
project { nil }
|
|
|
|
group { nil }
|
|
|
|
project_id { nil }
|
|
|
|
group_id { nil }
|
|
|
|
parent { nil }
|
2018-02-19 19:06:16 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
after(:build, :stub) do |board, evaluator|
|
|
|
|
if evaluator.group
|
|
|
|
board.group = evaluator.group
|
|
|
|
elsif evaluator.group_id
|
|
|
|
board.group_id = evaluator.group_id
|
|
|
|
elsif evaluator.project
|
|
|
|
board.project = evaluator.project
|
|
|
|
elsif evaluator.project_id
|
|
|
|
board.project_id = evaluator.project_id
|
|
|
|
elsif evaluator.parent
|
|
|
|
id = evaluator.parent.id
|
|
|
|
evaluator.parent.is_a?(Group) ? board.group_id = id : evaluator.project_id = id
|
|
|
|
else
|
|
|
|
board.project = create(:project, :empty_repo)
|
|
|
|
end
|
|
|
|
end
|
2016-10-06 19:20:21 +00:00
|
|
|
|
|
|
|
after(:create) do |board|
|
2017-03-24 12:40:35 +00:00
|
|
|
board.lists.create(list_type: :closed)
|
2016-10-06 19:20:21 +00:00
|
|
|
end
|
2016-07-27 21:46:03 +00:00
|
|
|
end
|
|
|
|
end
|