Commit 37ca748c authored by Shinya Maeda's avatar Shinya Maeda

Fix spec because of missing project for validation

parent 48316183
...@@ -94,7 +94,7 @@ module Clusters ...@@ -94,7 +94,7 @@ module Clusters
private private
def unique_environment_scope def unique_environment_scope
if project.clusters.where(environment_scope: environment_scope).where.not(id: self.id).exists? if project && project.clusters.where(environment_scope: environment_scope).where.not(id: self.id).exists?
errors.add(:base, "cannot add duplicated environment scope") errors.add(:base, "cannot add duplicated environment scope")
return false return false
end end
......
...@@ -4,7 +4,7 @@ FactoryBot.define do ...@@ -4,7 +4,7 @@ FactoryBot.define do
name 'test-cluster' name 'test-cluster'
trait :project do trait :project do
after(:create) do |cluster, evaluator| before(:create) do |cluster, evaluator|
cluster.projects << create(:project) cluster.projects << create(:project)
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