Merge pull request #5141 from tchak/fix-un-archive-when-repasser_en_instruction

Unarchive dossier when repasser_en_instruction
This commit is contained in:
Paul Chavard 2020-05-12 21:57:14 +02:00 committed by GitHub
commit d287942e6c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View file

@ -516,6 +516,7 @@ class Dossier < ApplicationRecord
end
def after_repasser_en_instruction(instructeur)
self.archived = false
self.processed_at = nil
self.motivation = nil
attestation&.destroy

View file

@ -1056,7 +1056,7 @@ describe Dossier do
end
describe '#repasser_en_instruction!' do
let(:dossier) { create(:dossier, :refuse, :with_attestation) }
let(:dossier) { create(:dossier, :refuse, :with_attestation, archived: true) }
let!(:instructeur) { create(:instructeur) }
let(:last_operation) { dossier.dossier_operation_logs.last }
@ -1069,6 +1069,7 @@ describe Dossier do
end
it { expect(dossier.state).to eq('en_instruction') }
it { expect(dossier.archived).to be_falsey }
it { expect(dossier.processed_at).to be_nil }
it { expect(dossier.motivation).to be_nil }
it { expect(dossier.attestation).to be_nil }