2019-07-25 01:11:48 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-12-13 19:13:44 -05:00
|
|
|
FactoryBot.define do
|
2016-11-22 11:58:10 -05:00
|
|
|
factory :project_statistics do
|
2017-05-31 09:43:19 -04:00
|
|
|
project
|
|
|
|
|
|
|
|
initialize_with do
|
|
|
|
# statistics are automatically created when a project is created
|
|
|
|
project&.statistics || new
|
|
|
|
end
|
2019-07-02 10:44:39 -04:00
|
|
|
|
|
|
|
transient do
|
|
|
|
with_data { false }
|
|
|
|
size_multiplier { 1 }
|
|
|
|
end
|
|
|
|
|
|
|
|
after(:build) do |project_statistics, evaluator|
|
|
|
|
if evaluator.with_data
|
|
|
|
project_statistics.repository_size = evaluator.size_multiplier
|
|
|
|
project_statistics.wiki_size = evaluator.size_multiplier * 2
|
|
|
|
project_statistics.lfs_objects_size = evaluator.size_multiplier * 3
|
|
|
|
project_statistics.build_artifacts_size = evaluator.size_multiplier * 4
|
|
|
|
project_statistics.packages_size = evaluator.size_multiplier * 5
|
|
|
|
end
|
|
|
|
end
|
2016-11-22 11:58:10 -05:00
|
|
|
end
|
|
|
|
end
|