2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
FactoryBot.define do
|
2017-08-17 22:00:37 +05:30
|
|
|
factory :project_statistics do
|
2017-09-10 17:25:29 +05:30
|
|
|
project
|
|
|
|
|
|
|
|
initialize_with do
|
|
|
|
# statistics are automatically created when a project is created
|
|
|
|
project&.statistics || new
|
|
|
|
end
|
2019-09-30 21:07:59 +05:30
|
|
|
|
|
|
|
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
|
2020-07-28 23:09:34 +05:30
|
|
|
project_statistics.snippets_size = evaluator.size_multiplier * 6
|
2020-11-24 15:15:51 +05:30
|
|
|
project_statistics.pipeline_artifacts_size = evaluator.size_multiplier * 7
|
2019-09-30 21:07:59 +05:30
|
|
|
end
|
|
|
|
end
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
end
|