2019-03-12 15:49:56 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
FactoryBot.define do
|
|
|
|
factory :repository_cell do
|
|
|
|
repository_row
|
2019-05-07 19:47:50 +08:00
|
|
|
|
|
|
|
trait :text_value do
|
|
|
|
repository_column { create :repository_column, :text_type, repository: repository_row.repository }
|
|
|
|
after(:build) do |repository_cell|
|
2019-07-26 18:40:36 +08:00
|
|
|
repository_cell.value ||= create(:repository_text_value, repository_cell: repository_cell)
|
2019-05-07 19:47:50 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
trait :date_value do
|
|
|
|
repository_column { create :repository_column, :date_type, repository: repository_row.repository }
|
|
|
|
after(:build) do |repository_cell|
|
|
|
|
repository_cell.value ||= build(:repository_date_value, repository_cell: repository_cell)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
trait :list_value do
|
|
|
|
repository_column { create :repository_column, :list_type, repository: repository_row.repository }
|
|
|
|
after(:build) do |repository_cell|
|
|
|
|
repository_cell.value ||= build(:repository_list_value, repository_cell: repository_cell)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
trait :asset_value do
|
|
|
|
repository_column { create :repository_column, :asset_type, repository: repository_row.repository }
|
|
|
|
after(:build) do |repository_cell|
|
|
|
|
repository_cell.value ||= build(:repository_asset_value, repository_cell: repository_cell)
|
|
|
|
end
|
|
|
|
end
|
2019-03-12 15:49:56 +08:00
|
|
|
end
|
|
|
|
end
|