Assign Factory: automatically link to procedure.defaut_groupe_factory

This commit is contained in:
simon lehericey 2019-08-26 15:26:30 +02:00
parent a0555bc820
commit 74096b6b3a
2 changed files with 4 additions and 1 deletions

View file

@ -1,4 +1,7 @@
FactoryBot.define do
factory :assign_to do
after(:build) do |assign_to, _evaluator|
assign_to.groupe_instructeur = assign_to.procedure.defaut_groupe_instructeur
end
end
end

View file

@ -1,7 +1,7 @@
describe AssignTo, type: :model do
describe '#procedure_presentation_or_default_and_errors' do
let(:procedure) { create(:procedure) }
let(:assign_to) { AssignTo.create(procedure: procedure) }
let(:assign_to) { create(:assign_to, procedure: procedure) }
let(:procedure_presentation_and_errors) { assign_to.procedure_presentation_or_default_and_errors }
let(:procedure_presentation_or_default) { procedure_presentation_and_errors.first }