diff --git a/spec/controllers/api/v2/graphql_controller_spec.rb b/spec/controllers/api/v2/graphql_controller_spec.rb index 1177464eb..6c7d7e7f8 100644 --- a/spec/controllers/api/v2/graphql_controller_spec.rb +++ b/spec/controllers/api/v2/graphql_controller_spec.rb @@ -288,8 +288,8 @@ describe API::V2::GraphqlController do end context "with entreprise" do - let(:procedure) { create(:procedure, :published, administrateurs: [admin]) } - let(:dossier) { create(:dossier, :en_construction, :with_entreprise, procedure: procedure) } + let(:procedure_for_entreprise) { create(:procedure, :published, administrateurs: [admin]) } + let(:dossier) { create(:dossier, :en_construction, :with_entreprise, procedure: procedure_for_entreprise) } let(:query) do "{ diff --git a/spec/factories/dossier.rb b/spec/factories/dossier.rb index 504405f08..c0b563521 100644 --- a/spec/factories/dossier.rb +++ b/spec/factories/dossier.rb @@ -25,6 +25,9 @@ FactoryBot.define do trait :with_entreprise do after(:build) do |dossier, _evaluator| + if dossier.procedure.for_individual? + raise 'Inconsistent factory: attempting to create a dossier :with_entreprise on a procedure that is `for_individual?`' + end etablissement = create(:etablissement) dossier.etablissement = etablissement end diff --git a/spec/views/users/dossiers/brouillon.html.haml_spec.rb b/spec/views/users/dossiers/brouillon.html.haml_spec.rb index dc13af78a..1d66d554f 100644 --- a/spec/views/users/dossiers/brouillon.html.haml_spec.rb +++ b/spec/views/users/dossiers/brouillon.html.haml_spec.rb @@ -1,8 +1,8 @@ require 'spec_helper' describe 'users/dossiers/brouillon.html.haml', type: :view do - let(:procedure) { create(:procedure, :with_type_de_champ, :with_notice, :with_service, for_individual: true) } - let(:dossier) { create(:dossier, :with_entreprise, state: Dossier.states.fetch(:brouillon), procedure: procedure) } + let(:procedure) { create(:procedure, :with_type_de_champ, :with_notice, :with_service) } + let(:dossier) { create(:dossier, state: Dossier.states.fetch(:brouillon), procedure: procedure) } let(:footer) { view.content_for(:footer) } before do diff --git a/spec/views/users/dossiers/identite.html.haml_spec.rb b/spec/views/users/dossiers/identite.html.haml_spec.rb index b5d954c67..2f01ef41c 100644 --- a/spec/views/users/dossiers/identite.html.haml_spec.rb +++ b/spec/views/users/dossiers/identite.html.haml_spec.rb @@ -1,8 +1,8 @@ require 'spec_helper' describe 'users/dossiers/identite.html.haml', type: :view do - let(:procedure) { create(:simple_procedure, for_individual: true) } - let(:dossier) { create(:dossier, :with_entreprise, :with_service, state: Dossier.states.fetch(:brouillon), procedure: procedure) } + let(:procedure) { create(:simple_procedure, :for_individual) } + let(:dossier) { create(:dossier, :with_service, state: Dossier.states.fetch(:brouillon), procedure: procedure) } before do sign_in dossier.user