Commit 4721cfe8 authored by Rémy Coutable's avatar Rémy Coutable

Extract EE-specific code from spec/factories/namespaces.rb

Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent faa2fb53
# frozen_string_literal: true
FactoryBot.modify do
factory :namespace do
transient do
plan nil
end
before(:create) do |namespace, evaluator|
if evaluator.plan.present?
namespace.plan = create(evaluator.plan)
end
end
trait :with_build_minutes do
namespace_statistics factory: :namespace_statistics, shared_runners_seconds: 400.minutes.to_i
end
trait :with_build_minutes_limit do
shared_runners_minutes_limit 500
end
trait :with_not_used_build_minutes_limit do
namespace_statistics factory: :namespace_statistics, shared_runners_seconds: 300.minutes.to_i
shared_runners_minutes_limit 500
end
trait :with_used_build_minutes_limit do
namespace_statistics factory: :namespace_statistics, shared_runners_seconds: 1000.minutes.to_i
shared_runners_minutes_limit 500
end
end
end
......@@ -19,34 +19,5 @@ FactoryBot.define do
owner.namespace = namespace
end
end
trait :with_build_minutes do
namespace_statistics factory: :namespace_statistics, shared_runners_seconds: 400.minutes.to_i
end
trait :with_build_minutes_limit do
shared_runners_minutes_limit 500
end
trait :with_not_used_build_minutes_limit do
namespace_statistics factory: :namespace_statistics, shared_runners_seconds: 300.minutes.to_i
shared_runners_minutes_limit 500
end
trait :with_used_build_minutes_limit do
namespace_statistics factory: :namespace_statistics, shared_runners_seconds: 1000.minutes.to_i
shared_runners_minutes_limit 500
end
# EE-only
transient do
plan nil
end
before :create do |namespace, evaluator|
if evaluator.plan.present?
namespace.plan = create(evaluator.plan)
end
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment