2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
FactoryBot.define do
|
2016-09-13 17:45:13 +05:30
|
|
|
factory :board do
|
2018-03-27 19:54:05 +05:30
|
|
|
transient do
|
|
|
|
project nil
|
|
|
|
group nil
|
|
|
|
project_id nil
|
|
|
|
group_id nil
|
|
|
|
parent nil
|
|
|
|
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-11-03 12:29:30 +05:30
|
|
|
|
|
|
|
after(:create) do |board|
|
2017-08-17 22:00:37 +05:30
|
|
|
board.lists.create(list_type: :closed)
|
2016-11-03 12:29:30 +05:30
|
|
|
end
|
2016-09-13 17:45:13 +05:30
|
|
|
end
|
|
|
|
end
|