diff --git a/test/factories/observation_units.rb b/test/factories/observation_units.rb index a5b130a87c..6310a82552 100644 --- a/test/factories/observation_units.rb +++ b/test/factories/observation_units.rb @@ -5,7 +5,7 @@ policy { FactoryBot.create(:public_policy) } association :contributor, factory: :person, strategy: :create after(:build) do |a| - a.study = FactoryBot.create(:study, contributor: a.contributor) if a.study.nil? + a.study ||= FactoryBot.create(:study, contributor: a.contributor) end end