debian-mirror-gitlab/spec/factories/boards.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

39 lines
970 B
Ruby
Raw Normal View History

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
2019-12-21 20:55:43 +05:30
project { nil }
group { nil }
project_id { nil }
group_id { nil }
resource_parent { nil }
2018-03-27 19:54:05 +05:30
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-12-21 20:55:43 +05:30
elsif evaluator.resource_parent
id = evaluator.resource_parent.id
evaluator.resource_parent.is_a?(Group) ? board.group_id = id : evaluator.project_id = id
2018-03-27 19:54:05 +05:30
else
board.project = create(:project, :empty_repo)
end
end
2016-11-03 12:29:30 +05:30
after(:create) do |board|
2020-10-24 23:57:45 +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
2021-03-08 18:12:59 +05:30
factory :group_board, parent: :board do
group
end
2016-09-13 17:45:13 +05:30
end