bug(avis#instruction): fail when claimant had been destroyed during a merge
This commit is contained in:
parent
d140d8c263
commit
91f1fa4ffb
1 changed files with 13 additions and 1 deletions
|
@ -4,9 +4,10 @@ describe Experts::AvisController, type: :controller do
|
|||
|
||||
let(:now) { Time.zone.parse('01/02/2345') }
|
||||
let(:instructeur) { create(:instructeur) }
|
||||
let(:another_instructeur) { create(:instructeur) }
|
||||
let(:claimant) { create(:expert) }
|
||||
let(:expert) { create(:expert) }
|
||||
let(:procedure) { create(:procedure, :published, instructeurs: [instructeur]) }
|
||||
let(:procedure) { create(:procedure, :published, instructeurs: [instructeur, another_instructeur]) }
|
||||
let(:another_procedure) { create(:procedure, :published, instructeurs: [instructeur]) }
|
||||
let(:dossier) { create(:dossier, :en_construction, procedure: procedure) }
|
||||
let(:experts_procedure) { create(:experts_procedure, expert: expert, procedure: procedure) }
|
||||
|
@ -106,6 +107,17 @@ describe Experts::AvisController, type: :controller do
|
|||
end
|
||||
end
|
||||
|
||||
context 'with destroyed claimant' do
|
||||
render_views
|
||||
it 'does not raise' do
|
||||
avis_with_merged_instructeur = create(:avis, dossier: dossier, claimant: another_instructeur, experts_procedure: experts_procedure)
|
||||
another_instructeur.user.destroy
|
||||
sign_in(expert.user)
|
||||
get :instruction, params: { id: avis_with_merged_instructeur.id, procedure_id: procedure.id }
|
||||
expect(response).to have_http_status(200)
|
||||
end
|
||||
end
|
||||
|
||||
describe '#messagerie' do
|
||||
subject { get :messagerie, params: { id: avis_without_answer.id, procedure_id: procedure.id } }
|
||||
context 'with valid avis' do
|
||||
|
|
Loading…
Reference in a new issue