2019-11-21 23:22:15 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
FactoryBot.define do
|
2019-12-08 23:53:59 +08:00
|
|
|
factory :repository_date_time_range_value_base do
|
2019-11-21 23:22:15 +08:00
|
|
|
created_by { create :user }
|
|
|
|
last_modified_by { created_by }
|
|
|
|
start_time { Time.zone.now }
|
|
|
|
end_time { Faker::Time.between(from: start_time, to: Time.zone.now + 3.days) }
|
2019-12-08 23:53:59 +08:00
|
|
|
end
|
2019-11-21 23:22:15 +08:00
|
|
|
|
2019-12-08 23:53:59 +08:00
|
|
|
factory :repository_date_time_range_value,
|
|
|
|
parent: :repository_date_time_range_value_base,
|
|
|
|
class: 'RepositoryDateTimeRangeValue' do
|
2019-11-21 23:22:15 +08:00
|
|
|
after(:build) do |value|
|
|
|
|
value.repository_cell ||= build(:repository_cell, :date_time_range_value, repository_date_time_range_value: value)
|
2020-02-17 07:26:20 +08:00
|
|
|
value.repository_cell.value = value
|
2019-11-21 23:22:15 +08:00
|
|
|
end
|
|
|
|
end
|
2019-12-08 23:53:59 +08:00
|
|
|
|
|
|
|
factory :repository_time_range_value,
|
|
|
|
parent: :repository_date_time_range_value_base,
|
|
|
|
class: 'RepositoryTimeRangeValue' do
|
|
|
|
after(:build) do |value|
|
|
|
|
value.repository_cell ||= build(:repository_cell, :time_range_value, repository_time_range_value: value)
|
2020-02-17 07:26:20 +08:00
|
|
|
value.repository_cell.value = value
|
2019-12-08 23:53:59 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
factory :repository_date_range_value,
|
|
|
|
parent: :repository_date_time_range_value_base,
|
|
|
|
class: 'RepositoryDateRangeValue' do
|
|
|
|
after(:build) do |value|
|
|
|
|
value.repository_cell ||= build(:repository_cell, :date_range_value, repository_date_range_value: value)
|
2020-02-17 07:26:20 +08:00
|
|
|
value.repository_cell.value = value
|
2019-12-08 23:53:59 +08:00
|
|
|
end
|
|
|
|
end
|
2019-11-21 23:22:15 +08:00
|
|
|
end
|