diff --git a/app/models/service.rb b/app/models/service.rb index 7b4edd599..062893d03 100644 --- a/app/models/service.rb +++ b/app/models/service.rb @@ -16,7 +16,7 @@ # class Service < ApplicationRecord has_many :procedures - belongs_to :administrateur + belongs_to :administrateur, optional: false scope :ordered, -> { order(nom: :asc) } diff --git a/spec/factories/service.rb b/spec/factories/service.rb index 889a80240..64dcaa9f9 100644 --- a/spec/factories/service.rb +++ b/spec/factories/service.rb @@ -3,10 +3,11 @@ FactoryBot.define do nom { 'service' } organisme { 'organisme' } type_organisme { Service.type_organismes.fetch(:association) } - administrateur { create(:administrateur) } email { 'email@toto.com' } telephone { '1234' } horaires { 'de 9 h à 18 h' } adresse { 'adresse' } + + association :administrateur end end