debian-mirror-gitlab/spec/factories/pool_repositories.rb

34 lines
605 B
Ruby
Raw Normal View History

2019-10-12 21:52:04 +05:30
# frozen_string_literal: true
2019-02-15 15:39:39 +05:30
FactoryBot.define do
factory :pool_repository do
shard { Shard.by_name("default") }
2019-12-21 20:55:43 +05:30
state { :none }
2019-02-15 15:39:39 +05:30
before(:create) do |pool|
2021-04-01 16:36:13 +05:30
pool.source_project ||= create(:project, :repository)
2019-07-31 22:56:46 +05:30
pool.source_project.update!(pool_repository: pool)
2019-02-15 15:39:39 +05:30
end
trait :scheduled do
2019-12-21 20:55:43 +05:30
state { :scheduled }
2019-02-15 15:39:39 +05:30
end
trait :failed do
2019-12-21 20:55:43 +05:30
state { :failed }
2019-02-15 15:39:39 +05:30
end
trait :obsolete do
2019-12-21 20:55:43 +05:30
state { :obsolete }
2019-02-15 15:39:39 +05:30
end
trait :ready do
2019-12-21 20:55:43 +05:30
state { :ready }
2019-02-15 15:39:39 +05:30
after(:create) do |pool|
pool.create_object_pool
end
end
end
end