Commit 42c6ccd2 authored by Tiger's avatar Tiger

Tweak FactoryBot definition for clusters

Only create an associated project or group if there
were none already specified.
parent 98a14a49
...@@ -12,7 +12,7 @@ FactoryBot.define do ...@@ -12,7 +12,7 @@ FactoryBot.define do
cluster_type { Clusters::Cluster.cluster_types[:project_type] } cluster_type { Clusters::Cluster.cluster_types[:project_type] }
before(:create) do |cluster, evaluator| before(:create) do |cluster, evaluator|
cluster.projects << create(:project, :repository) cluster.projects << create(:project, :repository) unless cluster.projects.present?
end end
end end
...@@ -20,7 +20,7 @@ FactoryBot.define do ...@@ -20,7 +20,7 @@ FactoryBot.define do
cluster_type { Clusters::Cluster.cluster_types[:group_type] } cluster_type { Clusters::Cluster.cluster_types[:group_type] }
before(:create) do |cluster, evalutor| before(:create) do |cluster, evalutor|
cluster.groups << create(:group) cluster.groups << create(:group) unless cluster.groups.present?
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