Merge pull request #9085 from tchak/graphql-fix-state-change-errors
ETQ intégrateur d’API, je voudrais voir un message d’erreur si le changement d’état échoue
This commit is contained in:
commit
e92c36185d
4 changed files with 137 additions and 322 deletions
|
@ -28,7 +28,9 @@ module Mutations
|
|||
end
|
||||
|
||||
def authorized?(dossier:, instructeur:, **args)
|
||||
if !dossier.en_instruction?
|
||||
if dossier.en_instruction? && dossier.any_etablissement_as_degraded_mode?
|
||||
return false, { errors: ["Les informations du SIRET du dossier ne sont pas complètes. Veuillez réessayer plus tard."] }
|
||||
elsif !dossier.en_instruction? || !dossier.can_terminer?
|
||||
return false, { errors: ["Le dossier est déjà #{dossier_display_state(dossier, lower: true)}"] }
|
||||
end
|
||||
dossier_authorized_for?(dossier, instructeur)
|
||||
|
|
|
@ -28,7 +28,9 @@ module Mutations
|
|||
end
|
||||
|
||||
def authorized?(dossier:, instructeur:, **args)
|
||||
if !dossier.en_instruction?
|
||||
if dossier.en_instruction? && dossier.any_etablissement_as_degraded_mode?
|
||||
return false, { errors: ["Les informations du SIRET du dossier ne sont pas complètes. Veuillez réessayer plus tard."] }
|
||||
elsif !dossier.en_instruction? || !dossier.can_terminer?
|
||||
return false, { errors: ["Le dossier est déjà #{dossier_display_state(dossier, lower: true)}"] }
|
||||
end
|
||||
dossier_authorized_for?(dossier, instructeur)
|
||||
|
|
|
@ -1024,278 +1024,6 @@ describe API::V2::GraphqlController do
|
|||
end
|
||||
end
|
||||
|
||||
describe 'dossierPasserEnInstruction' do
|
||||
let(:dossiers) { [dossier2, dossier1, dossier] }
|
||||
let(:dossier) { create(:dossier, :en_construction, :with_individual, procedure: procedure) }
|
||||
let(:instructeur_id) { instructeur.to_typed_id }
|
||||
let(:disable_notification) { false }
|
||||
let(:query) do
|
||||
"mutation {
|
||||
dossierPasserEnInstruction(input: {
|
||||
dossierId: \"#{dossier.to_typed_id}\",
|
||||
instructeurId: \"#{instructeur_id}\",
|
||||
disableNotification: #{disable_notification}
|
||||
}) {
|
||||
dossier {
|
||||
id
|
||||
state
|
||||
motivation
|
||||
}
|
||||
errors {
|
||||
message
|
||||
}
|
||||
}
|
||||
}"
|
||||
end
|
||||
|
||||
context 'success' do
|
||||
it "should passer en instruction dossier" do
|
||||
expect(gql_errors).to eq(nil)
|
||||
|
||||
expect(gql_data).to eq(dossierPasserEnInstruction: {
|
||||
dossier: {
|
||||
id: dossier.to_typed_id,
|
||||
state: "en_instruction",
|
||||
motivation: nil
|
||||
},
|
||||
errors: nil
|
||||
})
|
||||
|
||||
perform_enqueued_jobs except: [APIEntreprise::ServiceJob]
|
||||
expect(ActionMailer::Base.deliveries.size).to eq(1)
|
||||
end
|
||||
end
|
||||
|
||||
context 'validation error' do
|
||||
let(:dossier) { create(:dossier, :en_instruction, :with_individual, procedure: procedure) }
|
||||
|
||||
it "should fail" do
|
||||
expect(gql_errors).to eq(nil)
|
||||
expect(gql_data).to eq(dossierPasserEnInstruction: {
|
||||
errors: [{ message: "Le dossier est déjà en instruction" }],
|
||||
dossier: nil
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
context 'instructeur error' do
|
||||
let(:instructeur_id) { create(:instructeur).to_typed_id }
|
||||
|
||||
it "should fail" do
|
||||
expect(gql_errors).to eq(nil)
|
||||
expect(gql_data).to eq(dossierPasserEnInstruction: {
|
||||
errors: [{ message: 'L’instructeur n’a pas les droits d’accès à ce dossier' }],
|
||||
dossier: nil
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
context 'disable notification' do
|
||||
let(:disable_notification) { true }
|
||||
it "should passer en instruction dossier without notification" do
|
||||
expect(gql_errors).to eq(nil)
|
||||
|
||||
expect(gql_data).to eq(dossierPasserEnInstruction: {
|
||||
dossier: {
|
||||
id: dossier.to_typed_id,
|
||||
state: "en_instruction",
|
||||
motivation: nil
|
||||
},
|
||||
errors: nil
|
||||
})
|
||||
|
||||
perform_enqueued_jobs except: [APIEntreprise::ServiceJob]
|
||||
expect(ActionMailer::Base.deliveries.size).to eq(0)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'dossierRepasserEnInstruction' do
|
||||
let(:dossiers) { [dossier2, dossier1, dossier] }
|
||||
let(:dossier) { create(:dossier, :refuse, :with_individual, procedure: procedure) }
|
||||
let(:instructeur_id) { instructeur.to_typed_id }
|
||||
let(:disable_notification) { false }
|
||||
let(:query) do
|
||||
"mutation {
|
||||
dossierRepasserEnInstruction(input: {
|
||||
dossierId: \"#{dossier.to_typed_id}\",
|
||||
instructeurId: \"#{instructeur_id}\",
|
||||
disableNotification: #{disable_notification}
|
||||
}) {
|
||||
dossier {
|
||||
id
|
||||
state
|
||||
motivation
|
||||
}
|
||||
errors {
|
||||
message
|
||||
}
|
||||
}
|
||||
}"
|
||||
end
|
||||
|
||||
context 'success' do
|
||||
it "should repasser en instruction dossier" do
|
||||
expect(gql_errors).to eq(nil)
|
||||
|
||||
expect(gql_data).to eq(dossierRepasserEnInstruction: {
|
||||
dossier: {
|
||||
id: dossier.to_typed_id,
|
||||
state: "en_instruction",
|
||||
motivation: nil
|
||||
},
|
||||
errors: nil
|
||||
})
|
||||
|
||||
perform_enqueued_jobs except: [APIEntreprise::ServiceJob]
|
||||
expect(ActionMailer::Base.deliveries.size).to eq(1)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'dossierRepasserEnConstruction' do
|
||||
let(:dossiers) { [dossier2, dossier1, dossier] }
|
||||
let(:dossier) { create(:dossier, :en_instruction, :with_individual, procedure: procedure) }
|
||||
let(:instructeur_id) { instructeur.to_typed_id }
|
||||
let(:disable_notification) { false }
|
||||
let(:query) do
|
||||
"mutation {
|
||||
dossierRepasserEnConstruction(input: {
|
||||
dossierId: \"#{dossier.to_typed_id}\",
|
||||
instructeurId: \"#{instructeur_id}\",
|
||||
disableNotification: #{disable_notification}
|
||||
}) {
|
||||
dossier {
|
||||
id
|
||||
state
|
||||
motivation
|
||||
}
|
||||
errors {
|
||||
message
|
||||
}
|
||||
}
|
||||
}"
|
||||
end
|
||||
|
||||
context 'success' do
|
||||
it "should passer en instruction dossier" do
|
||||
expect(gql_errors).to eq(nil)
|
||||
|
||||
expect(gql_data).to eq(dossierRepasserEnConstruction: {
|
||||
dossier: {
|
||||
id: dossier.to_typed_id,
|
||||
state: "en_construction",
|
||||
motivation: nil
|
||||
},
|
||||
errors: nil
|
||||
})
|
||||
|
||||
perform_enqueued_jobs except: [APIEntreprise::ServiceJob]
|
||||
expect(ActionMailer::Base.deliveries.size).to eq(0)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'dossierClasserSansSuite' do
|
||||
let(:dossier) { create(:dossier, :en_instruction, :with_individual, procedure: procedure) }
|
||||
let(:query) do
|
||||
"mutation {
|
||||
dossierClasserSansSuite(input: {
|
||||
dossierId: \"#{dossier.to_typed_id}\",
|
||||
instructeurId: \"#{instructeur.to_typed_id}\",
|
||||
motivation: \"Parce que\",
|
||||
justificatif: \"#{blob.signed_id}\"
|
||||
}) {
|
||||
dossier {
|
||||
id
|
||||
state
|
||||
motivation
|
||||
}
|
||||
errors {
|
||||
message
|
||||
}
|
||||
}
|
||||
}"
|
||||
end
|
||||
|
||||
context 'success' do
|
||||
it "should classer sans suite dossier" do
|
||||
expect(gql_errors).to eq(nil)
|
||||
|
||||
expect(gql_data).to eq(dossierClasserSansSuite: {
|
||||
dossier: {
|
||||
id: dossier.to_typed_id,
|
||||
state: "sans_suite",
|
||||
motivation: "Parce que"
|
||||
},
|
||||
errors: nil
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
context 'validation error' do
|
||||
let(:dossier) { create(:dossier, :accepte, :with_individual, procedure: procedure) }
|
||||
|
||||
it "should fail" do
|
||||
expect(gql_errors).to eq(nil)
|
||||
expect(gql_data).to eq(dossierClasserSansSuite: {
|
||||
errors: [{ message: "Le dossier est déjà accepté" }],
|
||||
dossier: nil
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'dossierRefuser' do
|
||||
let(:dossier) { create(:dossier, :en_instruction, :with_individual, procedure: procedure) }
|
||||
let(:query) do
|
||||
"mutation {
|
||||
dossierRefuser(input: {
|
||||
dossierId: \"#{dossier.to_typed_id}\",
|
||||
instructeurId: \"#{instructeur.to_typed_id}\",
|
||||
motivation: \"Parce que\",
|
||||
justificatif: \"#{blob.signed_id}\"
|
||||
}) {
|
||||
dossier {
|
||||
id
|
||||
state
|
||||
motivation
|
||||
}
|
||||
errors {
|
||||
message
|
||||
}
|
||||
}
|
||||
}"
|
||||
end
|
||||
|
||||
context 'success' do
|
||||
it "should refuser dossier" do
|
||||
expect(gql_errors).to eq(nil)
|
||||
|
||||
expect(gql_data).to eq(dossierRefuser: {
|
||||
dossier: {
|
||||
id: dossier.to_typed_id,
|
||||
state: "refuse",
|
||||
motivation: "Parce que"
|
||||
},
|
||||
errors: nil
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
context 'validation error' do
|
||||
let(:dossier) { create(:dossier, :sans_suite, :with_individual, procedure: procedure) }
|
||||
|
||||
it "should fail" do
|
||||
expect(gql_errors).to eq(nil)
|
||||
expect(gql_data).to eq(dossierRefuser: {
|
||||
errors: [{ message: "Le dossier est déjà classé sans suite" }],
|
||||
dossier: nil
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'dossierAccepter' do
|
||||
let(:dossier) { create(:dossier, :en_instruction, :with_individual, procedure: procedure) }
|
||||
let(:query) do
|
||||
|
@ -1489,48 +1217,6 @@ describe API::V2::GraphqlController do
|
|||
end
|
||||
end
|
||||
|
||||
describe 'dossierArchiver' do
|
||||
let(:query) do
|
||||
"mutation {
|
||||
dossierArchiver(input: {
|
||||
dossierId: \"#{dossier.to_typed_id}\",
|
||||
instructeurId: \"#{instructeur.to_typed_id}\"
|
||||
}) {
|
||||
dossier {
|
||||
archived
|
||||
}
|
||||
errors {
|
||||
message
|
||||
}
|
||||
}
|
||||
}"
|
||||
end
|
||||
|
||||
it "validation error" do
|
||||
expect(gql_errors).to eq(nil)
|
||||
|
||||
expect(gql_data).to eq(dossierArchiver: {
|
||||
dossier: nil,
|
||||
errors: [{ message: "Un dossier ne peut être archivé qu’une fois le traitement terminé" }]
|
||||
})
|
||||
end
|
||||
|
||||
context "should archive dossier" do
|
||||
let(:dossier) { create(:dossier, :sans_suite, :with_individual, procedure: procedure) }
|
||||
|
||||
it "change made" do
|
||||
expect(gql_errors).to eq(nil)
|
||||
|
||||
expect(gql_data).to eq(dossierArchiver: {
|
||||
dossier: {
|
||||
archived: true
|
||||
},
|
||||
errors: nil
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'dossierModifierAnnotation' do
|
||||
let(:procedure) { create(:procedure, :published, :for_individual, :with_service, :with_all_annotations, administrateurs: [admin]) }
|
||||
|
||||
|
|
|
@ -338,6 +338,7 @@ describe API::V2::GraphqlController do
|
|||
|
||||
describe 'ds-mutation-v2' do
|
||||
let(:query_id) { 'ds-mutation-v2' }
|
||||
let(:disableNotification) { nil }
|
||||
|
||||
context 'not found operation name' do
|
||||
let(:operation_name) { 'dossierStuff' }
|
||||
|
@ -366,11 +367,19 @@ describe API::V2::GraphqlController do
|
|||
expect(gql_data[:dossierArchiver][:errors].first[:message]).to eq('Le jeton utilisé est configuré seulement en lecture')
|
||||
}
|
||||
end
|
||||
|
||||
context 'when not processed' do
|
||||
let(:dossier) { create(:dossier, :en_instruction, :with_individual, procedure:) }
|
||||
|
||||
it {
|
||||
expect(gql_data[:dossierArchiver][:errors].first[:message]).to eq('Un dossier ne peut être archivé qu’une fois le traitement terminé')
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
context 'dossierPasserEnInstruction' do
|
||||
let(:dossier) { create(:dossier, :en_construction, :with_individual, procedure: procedure) }
|
||||
let(:variables) { { input: { dossierId: dossier.to_typed_id, instructeurId: instructeur.to_typed_id } } }
|
||||
let(:variables) { { input: { dossierId: dossier.to_typed_id, instructeurId: instructeur.to_typed_id, disableNotification: } } }
|
||||
let(:operation_name) { 'dossierPasserEnInstruction' }
|
||||
|
||||
it {
|
||||
|
@ -378,12 +387,24 @@ describe API::V2::GraphqlController do
|
|||
expect(gql_data[:dossierPasserEnInstruction][:errors]).to be_nil
|
||||
expect(gql_data[:dossierPasserEnInstruction][:dossier][:id]).to eq(dossier.to_typed_id)
|
||||
expect(gql_data[:dossierPasserEnInstruction][:dossier][:state]).to eq('en_instruction')
|
||||
perform_enqueued_jobs
|
||||
expect(ActionMailer::Base.deliveries.size).to eq(1)
|
||||
}
|
||||
|
||||
context 'without notifications' do
|
||||
let(:disableNotification) { true }
|
||||
|
||||
it {
|
||||
expect(gql_errors).to be_nil
|
||||
perform_enqueued_jobs
|
||||
expect(ActionMailer::Base.deliveries.size).to eq(0)
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
context 'dossierRepasserEnConstruction' do
|
||||
let(:dossier) { create(:dossier, :en_instruction, :with_individual, procedure: procedure) }
|
||||
let(:variables) { { input: { dossierId: dossier.to_typed_id, instructeurId: instructeur.to_typed_id } } }
|
||||
let(:variables) { { input: { dossierId: dossier.to_typed_id, instructeurId: instructeur.to_typed_id, disableNotification: } } }
|
||||
let(:operation_name) { 'dossierRepasserEnConstruction' }
|
||||
|
||||
it {
|
||||
|
@ -396,7 +417,7 @@ describe API::V2::GraphqlController do
|
|||
|
||||
context 'dossierRepasserEnInstruction' do
|
||||
let(:dossier) { create(:dossier, :refuse, :with_individual, procedure: procedure) }
|
||||
let(:variables) { { input: { dossierId: dossier.to_typed_id, instructeurId: instructeur.to_typed_id } } }
|
||||
let(:variables) { { input: { dossierId: dossier.to_typed_id, instructeurId: instructeur.to_typed_id, disableNotification: } } }
|
||||
let(:operation_name) { 'dossierRepasserEnInstruction' }
|
||||
|
||||
it {
|
||||
|
@ -404,12 +425,24 @@ describe API::V2::GraphqlController do
|
|||
expect(gql_data[:dossierRepasserEnInstruction][:errors]).to be_nil
|
||||
expect(gql_data[:dossierRepasserEnInstruction][:dossier][:id]).to eq(dossier.to_typed_id)
|
||||
expect(gql_data[:dossierRepasserEnInstruction][:dossier][:state]).to eq('en_instruction')
|
||||
perform_enqueued_jobs
|
||||
expect(ActionMailer::Base.deliveries.size).to eq(1)
|
||||
}
|
||||
|
||||
context 'without notifications' do
|
||||
let(:disableNotification) { true }
|
||||
|
||||
it {
|
||||
expect(gql_errors).to be_nil
|
||||
perform_enqueued_jobs
|
||||
expect(ActionMailer::Base.deliveries.size).to eq(0)
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
context 'dossierAccepter' do
|
||||
let(:dossier) { create(:dossier, :en_instruction, :with_individual, procedure: procedure) }
|
||||
let(:variables) { { input: { dossierId: dossier.to_typed_id, instructeurId: instructeur.to_typed_id } } }
|
||||
let(:variables) { { input: { dossierId: dossier.to_typed_id, instructeurId: instructeur.to_typed_id, disableNotification: } } }
|
||||
let(:operation_name) { 'dossierAccepter' }
|
||||
|
||||
it {
|
||||
|
@ -417,8 +450,20 @@ describe API::V2::GraphqlController do
|
|||
expect(gql_data[:dossierAccepter][:errors]).to be_nil
|
||||
expect(gql_data[:dossierAccepter][:dossier][:id]).to eq(dossier.to_typed_id)
|
||||
expect(gql_data[:dossierAccepter][:dossier][:state]).to eq('accepte')
|
||||
perform_enqueued_jobs
|
||||
expect(ActionMailer::Base.deliveries.size).to eq(1)
|
||||
}
|
||||
|
||||
context 'without notifications' do
|
||||
let(:disableNotification) { true }
|
||||
|
||||
it {
|
||||
expect(gql_errors).to be_nil
|
||||
perform_enqueued_jobs
|
||||
expect(ActionMailer::Base.deliveries.size).to eq(0)
|
||||
}
|
||||
end
|
||||
|
||||
context 'read only token' do
|
||||
before { api_token.update(write_access: false) }
|
||||
|
||||
|
@ -458,7 +503,7 @@ describe API::V2::GraphqlController do
|
|||
|
||||
context 'dossierRefuser' do
|
||||
let(:dossier) { create(:dossier, :en_instruction, :with_individual, procedure: procedure) }
|
||||
let(:variables) { { input: { dossierId: dossier.to_typed_id, instructeurId: instructeur.to_typed_id, motivation: 'yolo' } } }
|
||||
let(:variables) { { input: { dossierId: dossier.to_typed_id, instructeurId: instructeur.to_typed_id, motivation: 'yolo', disableNotification: } } }
|
||||
let(:operation_name) { 'dossierRefuser' }
|
||||
|
||||
it {
|
||||
|
@ -466,8 +511,20 @@ describe API::V2::GraphqlController do
|
|||
expect(gql_data[:dossierRefuser][:errors]).to be_nil
|
||||
expect(gql_data[:dossierRefuser][:dossier][:id]).to eq(dossier.to_typed_id)
|
||||
expect(gql_data[:dossierRefuser][:dossier][:state]).to eq('refuse')
|
||||
perform_enqueued_jobs
|
||||
expect(ActionMailer::Base.deliveries.size).to eq(1)
|
||||
}
|
||||
|
||||
context 'without notifications' do
|
||||
let(:disableNotification) { true }
|
||||
|
||||
it {
|
||||
expect(gql_errors).to be_nil
|
||||
perform_enqueued_jobs
|
||||
expect(ActionMailer::Base.deliveries.size).to eq(0)
|
||||
}
|
||||
end
|
||||
|
||||
context 'read only token' do
|
||||
before { api_token.update(write_access: false) }
|
||||
|
||||
|
@ -475,11 +532,39 @@ describe API::V2::GraphqlController do
|
|||
expect(gql_data[:dossierRefuser][:errors].first[:message]).to eq('Le jeton utilisé est configuré seulement en lecture')
|
||||
}
|
||||
end
|
||||
|
||||
context 'when already accepted' do
|
||||
let(:dossier) { create(:dossier, :accepte, :with_individual, procedure:) }
|
||||
|
||||
it {
|
||||
expect(gql_data[:dossierRefuser][:errors].first[:message]).to eq('Le dossier est déjà accepté')
|
||||
}
|
||||
end
|
||||
|
||||
context 'with entreprise' do
|
||||
let(:procedure) { create(:procedure, :published, :with_service, administrateurs: [admin]) }
|
||||
let(:dossier) { create(:dossier, :en_instruction, :with_entreprise, procedure:) }
|
||||
|
||||
it {
|
||||
expect(gql_errors).to be_nil
|
||||
expect(gql_data[:dossierRefuser][:errors]).to be_nil
|
||||
expect(gql_data[:dossierRefuser][:dossier][:id]).to eq(dossier.to_typed_id)
|
||||
expect(gql_data[:dossierRefuser][:dossier][:state]).to eq('refuse')
|
||||
}
|
||||
|
||||
context 'when in degraded mode' do
|
||||
before { dossier.etablissement.update(adresse: nil) }
|
||||
|
||||
it {
|
||||
expect(gql_data[:dossierRefuser][:errors].first[:message]).to eq('Les informations du SIRET du dossier ne sont pas complètes. Veuillez réessayer plus tard.')
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'dossierClasserSansSuite' do
|
||||
let(:dossier) { create(:dossier, :en_instruction, :with_individual, procedure: procedure) }
|
||||
let(:variables) { { input: { dossierId: dossier.to_typed_id, instructeurId: instructeur.to_typed_id, motivation: 'yolo' } } }
|
||||
let(:variables) { { input: { dossierId: dossier.to_typed_id, instructeurId: instructeur.to_typed_id, motivation: 'yolo', disableNotification: } } }
|
||||
let(:operation_name) { 'dossierClasserSansSuite' }
|
||||
|
||||
it {
|
||||
|
@ -487,8 +572,20 @@ describe API::V2::GraphqlController do
|
|||
expect(gql_data[:dossierClasserSansSuite][:errors]).to be_nil
|
||||
expect(gql_data[:dossierClasserSansSuite][:dossier][:id]).to eq(dossier.to_typed_id)
|
||||
expect(gql_data[:dossierClasserSansSuite][:dossier][:state]).to eq('sans_suite')
|
||||
perform_enqueued_jobs
|
||||
expect(ActionMailer::Base.deliveries.size).to eq(1)
|
||||
}
|
||||
|
||||
context 'without notifications' do
|
||||
let(:disableNotification) { true }
|
||||
|
||||
it {
|
||||
expect(gql_errors).to be_nil
|
||||
perform_enqueued_jobs
|
||||
expect(ActionMailer::Base.deliveries.size).to eq(0)
|
||||
}
|
||||
end
|
||||
|
||||
context 'read only token' do
|
||||
before { api_token.update(write_access: false) }
|
||||
|
||||
|
@ -496,6 +593,34 @@ describe API::V2::GraphqlController do
|
|||
expect(gql_data[:dossierClasserSansSuite][:errors].first[:message]).to eq('Le jeton utilisé est configuré seulement en lecture')
|
||||
}
|
||||
end
|
||||
|
||||
context 'when already accepted' do
|
||||
let(:dossier) { create(:dossier, :accepte, :with_individual, procedure:) }
|
||||
|
||||
it {
|
||||
expect(gql_data[:dossierClasserSansSuite][:errors].first[:message]).to eq('Le dossier est déjà accepté')
|
||||
}
|
||||
end
|
||||
|
||||
context 'with entreprise' do
|
||||
let(:procedure) { create(:procedure, :published, :with_service, administrateurs: [admin]) }
|
||||
let(:dossier) { create(:dossier, :en_instruction, :with_entreprise, procedure:) }
|
||||
|
||||
it {
|
||||
expect(gql_errors).to be_nil
|
||||
expect(gql_data[:dossierClasserSansSuite][:errors]).to be_nil
|
||||
expect(gql_data[:dossierClasserSansSuite][:dossier][:id]).to eq(dossier.to_typed_id)
|
||||
expect(gql_data[:dossierClasserSansSuite][:dossier][:state]).to eq('sans_suite')
|
||||
}
|
||||
|
||||
context 'when in degraded mode' do
|
||||
before { dossier.etablissement.update(adresse: nil) }
|
||||
|
||||
it {
|
||||
expect(gql_data[:dossierClasserSansSuite][:errors].first[:message]).to eq('Les informations du SIRET du dossier ne sont pas complètes. Veuillez réessayer plus tard.')
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'groupeInstructeurModifier' do
|
||||
|
|
Loading…
Reference in a new issue