2019-07-25 05:11:48 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-12-14 00:13:44 +00:00
|
|
|
FactoryBot.define do
|
2016-11-22 16:58:10 +00:00
|
|
|
factory :project_statistics do
|
2017-05-31 13:43:19 +00:00
|
|
|
project
|
|
|
|
|
|
|
|
initialize_with do
|
|
|
|
# statistics are automatically created when a project is created
|
|
|
|
project&.statistics || new
|
|
|
|
end
|
2019-07-02 14:44:39 +00: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
|
2020-06-26 15:08:45 +00:00
|
|
|
project_statistics.snippets_size = evaluator.size_multiplier * 6
|
2019-07-02 14:44:39 +00:00
|
|
|
end
|
|
|
|
end
|
2016-11-22 16:58:10 +00:00
|
|
|
end
|
|
|
|
end
|