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
|
|
|
|
|
2019-11-21 23:22:15 +08:00
|
|
|
trait :date_time_value do
|
|
|
|
repository_column { create :repository_column, :date_time_type, repository: repository_row.repository }
|
2019-05-07 19:47:50 +08:00
|
|
|
after(:build) do |repository_cell|
|
2019-11-21 23:22:15 +08:00
|
|
|
repository_cell.value ||= build(:repository_date_time_value, repository_cell: repository_cell)
|
2019-05-07 19:47:50 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2019-12-08 23:53:59 +08:00
|
|
|
trait :time_value do
|
|
|
|
repository_column { create :repository_column, :time_type, repository: repository_row.repository }
|
|
|
|
after(:build) do |repository_cell|
|
|
|
|
repository_cell.value ||= build(:repository_time_value, repository_cell: repository_cell)
|
|
|
|
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
|
|
|
|
|
2019-05-07 19:47:50 +08:00
|
|
|
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-10-08 19:38:57 +08:00
|
|
|
|
|
|
|
trait :status_value do
|
|
|
|
repository_column { create :repository_column, :status_type, repository: repository_row.repository }
|
|
|
|
after(:build) do |repository_cell|
|
|
|
|
repository_cell.value ||= build(:repository_status_value, repository_cell: repository_cell)
|
|
|
|
end
|
|
|
|
end
|
2019-11-18 22:21:57 +08:00
|
|
|
|
2019-11-21 23:22:15 +08:00
|
|
|
trait :date_time_range_value do
|
|
|
|
repository_column { create :repository_column, :date_time_range_type, repository: repository_row.repository }
|
2019-11-18 22:21:57 +08:00
|
|
|
after(:build) do |repository_cell|
|
2019-11-21 23:22:15 +08:00
|
|
|
repository_cell.value ||= build(:repository_date_time_range_value, repository_cell: repository_cell)
|
2019-11-18 22:21:57 +08:00
|
|
|
end
|
|
|
|
end
|
2019-12-06 21:16:20 +08:00
|
|
|
|
2019-12-08 23:53:59 +08:00
|
|
|
trait :date_range_value do
|
|
|
|
repository_column { create :repository_column, :date_range_type, repository: repository_row.repository }
|
|
|
|
after(:build) do |repository_cell|
|
|
|
|
repository_cell.value ||= build(:repository_date_range_value, repository_cell: repository_cell)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
trait :time_range_value do
|
|
|
|
repository_column { create :repository_column, :time_range_type, repository: repository_row.repository }
|
|
|
|
after(:build) do |repository_cell|
|
|
|
|
repository_cell.value ||= build(:repository_time_range_value, repository_cell: repository_cell)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2019-12-06 21:16:20 +08:00
|
|
|
trait :checkbox_value do
|
2020-01-10 18:09:47 +08:00
|
|
|
repository_column { create :repository_column, :checklist_type, repository: repository_row.repository }
|
2019-12-06 21:16:20 +08:00
|
|
|
after(:build) do |repository_cell|
|
2020-01-10 18:09:47 +08:00
|
|
|
repository_cell.value ||= build(:repository_checklist_value, repository_cell: repository_cell)
|
2019-12-06 21:16:20 +08:00
|
|
|
end
|
|
|
|
end
|
2022-03-30 20:33:26 +08:00
|
|
|
|
|
|
|
trait :stock_value do
|
|
|
|
repository_column { create :repository_column, :stock_type, repository: repository_row.repository }
|
|
|
|
after(:build) do |repository_cell|
|
|
|
|
repository_cell.value ||= build(:repository_stock_value, repository_cell: repository_cell)
|
|
|
|
end
|
|
|
|
end
|
2019-03-12 15:49:56 +08:00
|
|
|
end
|
|
|
|
end
|