Fix discarded dossiers destruction
This commit is contained in:
parent
6e32117497
commit
5b56ec425b
2 changed files with 15 additions and 0 deletions
|
@ -62,6 +62,9 @@ class Dossier < ApplicationRecord
|
||||||
has_one :attestation, dependent: :destroy
|
has_one :attestation, dependent: :destroy
|
||||||
has_one :france_connect_information, through: :user
|
has_one :france_connect_information, through: :user
|
||||||
|
|
||||||
|
# FIXME: some dossiers have more than one attestation
|
||||||
|
has_many :attestations, dependent: :destroy
|
||||||
|
|
||||||
has_one_attached :justificatif_motivation
|
has_one_attached :justificatif_motivation
|
||||||
has_one_attached :pdf_export_for_instructeur
|
has_one_attached :pdf_export_for_instructeur
|
||||||
|
|
||||||
|
|
|
@ -1422,4 +1422,16 @@ describe Dossier do
|
||||||
it { expect(dossier.api_entreprise_job_exceptions).to eq(['#<StandardError: My special exception!>']) }
|
it { expect(dossier.api_entreprise_job_exceptions).to eq(['#<StandardError: My special exception!>']) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "#destroy" do
|
||||||
|
let(:dossier) { create(:dossier) }
|
||||||
|
before do
|
||||||
|
create(:attestation, dossier: dossier)
|
||||||
|
create(:attestation, dossier: dossier)
|
||||||
|
end
|
||||||
|
|
||||||
|
it "can destroy dossier with two attestations" do
|
||||||
|
expect(dossier.destroy).to be_truthy
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue