Tweak FactoryBot definition for clusters

Only create an associated project or group if there
were none already specified.
This commit is contained in:
Tiger 2019-03-04 12:14:47 +11:00
parent 98a14a498d
commit 42c6ccd209

View file

@ -12,7 +12,7 @@ FactoryBot.define do
cluster_type { Clusters::Cluster.cluster_types[:project_type] }
before(:create) do |cluster, evaluator|
cluster.projects << create(:project, :repository)
cluster.projects << create(:project, :repository) unless cluster.projects.present?
end
end
@ -20,7 +20,7 @@ FactoryBot.define do
cluster_type { Clusters::Cluster.cluster_types[:group_type] }
before(:create) do |cluster, evalutor|
cluster.groups << create(:group)
cluster.groups << create(:group) unless cluster.groups.present?
end
end