factories: ensure that dossiers with_entreprise
are consistent
This commit is contained in:
parent
0efb62f03a
commit
792ba73643
4 changed files with 9 additions and 6 deletions
|
@ -288,8 +288,8 @@ describe API::V2::GraphqlController do
|
||||||
end
|
end
|
||||||
|
|
||||||
context "with entreprise" do
|
context "with entreprise" do
|
||||||
let(:procedure) { create(:procedure, :published, administrateurs: [admin]) }
|
let(:procedure_for_entreprise) { create(:procedure, :published, administrateurs: [admin]) }
|
||||||
let(:dossier) { create(:dossier, :en_construction, :with_entreprise, procedure: procedure) }
|
let(:dossier) { create(:dossier, :en_construction, :with_entreprise, procedure: procedure_for_entreprise) }
|
||||||
|
|
||||||
let(:query) do
|
let(:query) do
|
||||||
"{
|
"{
|
||||||
|
|
|
@ -25,6 +25,9 @@ FactoryBot.define do
|
||||||
|
|
||||||
trait :with_entreprise do
|
trait :with_entreprise do
|
||||||
after(:build) do |dossier, _evaluator|
|
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)
|
etablissement = create(:etablissement)
|
||||||
dossier.etablissement = etablissement
|
dossier.etablissement = etablissement
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe 'users/dossiers/brouillon.html.haml', type: :view do
|
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(:procedure) { create(:procedure, :with_type_de_champ, :with_notice, :with_service) }
|
||||||
let(:dossier) { create(:dossier, :with_entreprise, state: Dossier.states.fetch(:brouillon), procedure: procedure) }
|
let(:dossier) { create(:dossier, state: Dossier.states.fetch(:brouillon), procedure: procedure) }
|
||||||
let(:footer) { view.content_for(:footer) }
|
let(:footer) { view.content_for(:footer) }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe 'users/dossiers/identite.html.haml', type: :view do
|
describe 'users/dossiers/identite.html.haml', type: :view do
|
||||||
let(:procedure) { create(:simple_procedure, for_individual: true) }
|
let(:procedure) { create(:simple_procedure, :for_individual) }
|
||||||
let(:dossier) { create(:dossier, :with_entreprise, :with_service, state: Dossier.states.fetch(:brouillon), procedure: procedure) }
|
let(:dossier) { create(:dossier, :with_service, state: Dossier.states.fetch(:brouillon), procedure: procedure) }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
sign_in dossier.user
|
sign_in dossier.user
|
||||||
|
|
Loading…
Reference in a new issue