2019-07-25 01:11:48 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-12-13 19:13:44 -05:00
|
|
|
FactoryBot.define do
|
2016-07-27 17:46:03 -04:00
|
|
|
factory :board do
|
2018-02-19 14:06:16 -05:00
|
|
|
transient do
|
2019-10-01 20:06:26 -04:00
|
|
|
project { nil }
|
|
|
|
group { nil }
|
|
|
|
project_id { nil }
|
|
|
|
group_id { nil }
|
2019-10-17 08:07:33 -04:00
|
|
|
resource_parent { nil }
|
2018-02-19 14:06:16 -05: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
|
2019-10-17 08:07:33 -04:00
|
|
|
elsif evaluator.resource_parent
|
|
|
|
id = evaluator.resource_parent.id
|
|
|
|
evaluator.resource_parent.is_a?(Group) ? board.group_id = id : evaluator.project_id = id
|
2018-02-19 14:06:16 -05:00
|
|
|
else
|
|
|
|
board.project = create(:project, :empty_repo)
|
|
|
|
end
|
|
|
|
end
|
2016-10-06 15:20:21 -04:00
|
|
|
|
|
|
|
after(:create) do |board|
|
2020-07-21 08:09:30 -04:00
|
|
|
board.lists.create!(list_type: :closed)
|
2016-10-06 15:20:21 -04:00
|
|
|
end
|
2016-07-27 17:46:03 -04:00
|
|
|
end
|
2021-01-07 19:10:44 -05:00
|
|
|
|
|
|
|
factory :group_board, parent: :board do
|
|
|
|
group
|
|
|
|
end
|
2016-07-27 17:46:03 -04:00
|
|
|
end
|