2017-10-29 14:48:45 -04:00
|
|
|
FactoryGirl.define do
|
|
|
|
factory :cluster, class: Clusters::Cluster do
|
|
|
|
user
|
|
|
|
name 'test-cluster'
|
|
|
|
|
|
|
|
trait :project do
|
|
|
|
after(:create) do |cluster, evaluator|
|
|
|
|
cluster.projects << create(:project)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
trait :provided_by_user do
|
|
|
|
provider_type :user
|
|
|
|
platform_type :kubernetes
|
2017-10-30 08:55:18 -04:00
|
|
|
|
|
|
|
platform_kubernetes do
|
2017-11-06 09:06:10 -05:00
|
|
|
create(:cluster_platform_kubernetes, :configured)
|
2017-10-30 08:55:18 -04:00
|
|
|
end
|
2017-10-29 14:48:45 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
trait :provided_by_gcp do
|
|
|
|
provider_type :gcp
|
|
|
|
platform_type :kubernetes
|
2017-10-30 08:55:18 -04:00
|
|
|
|
2017-11-02 14:37:32 -04:00
|
|
|
before(:create) do |cluster, evaluator|
|
2017-11-06 09:06:10 -05:00
|
|
|
cluster.platform_kubernetes = build(:cluster_platform_kubernetes, :configured)
|
|
|
|
cluster.provider_gcp = build(:cluster_provider_gcp, :created)
|
2017-10-29 14:48:45 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
trait :providing_by_gcp do
|
|
|
|
provider_type :gcp
|
|
|
|
|
|
|
|
provider_gcp do
|
2017-11-06 09:06:10 -05:00
|
|
|
create(:cluster_provider_gcp, :creating)
|
2017-10-29 14:48:45 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|