diff --git a/spec/factories/dossier.rb b/spec/factories/dossier.rb index 5369a4b8b..504405f08 100644 --- a/spec/factories/dossier.rb +++ b/spec/factories/dossier.rb @@ -43,6 +43,9 @@ FactoryBot.define do if evaluator.procedure.nil? dossier.procedure.update(for_individual: true) end + if !dossier.procedure.for_individual? + raise 'Inconsistent factory: attempting to create a dossier :with_individual on a procedure that is not `for_individual?`' + end dossier.individual = create(:individual) end end diff --git a/spec/models/dossier_spec.rb b/spec/models/dossier_spec.rb index 0f6c67409..85376e90e 100644 --- a/spec/models/dossier_spec.rb +++ b/spec/models/dossier_spec.rb @@ -573,7 +573,7 @@ describe Dossier do end describe '#owner_name' do - let!(:procedure) { create(:procedure) } + let(:procedure) { create(:procedure) } subject { dossier.owner_name } context 'when there is no entreprise or individual' do @@ -589,6 +589,7 @@ describe Dossier do end context 'when there is an individual' do + let(:procedure) { create(:procedure, :for_individual) } let(:dossier) { create(:dossier, :with_individual, procedure: procedure) } it { is_expected.to eq("#{dossier.individual.nom} #{dossier.individual.prenom}") } diff --git a/spec/views/commencer/show.html.haml_spec.rb b/spec/views/commencer/show.html.haml_spec.rb index 22fc05505..3d758d664 100644 --- a/spec/views/commencer/show.html.haml_spec.rb +++ b/spec/views/commencer/show.html.haml_spec.rb @@ -3,7 +3,7 @@ require 'rails_helper' RSpec.describe 'commencer/show.html.haml', type: :view do include Rails.application.routes.url_helpers - let(:procedure) { create(:procedure, :with_service, :published) } + let(:procedure) { create(:procedure, :published, :for_individual, :with_service) } before do assign(:procedure, procedure)