clean(dossier): useless method

This commit is contained in:
simon lehericey 2022-11-28 14:25:14 +01:00
parent 9a8c1ce224
commit f96a7f432c
2 changed files with 0 additions and 30 deletions

View file

@ -508,12 +508,6 @@ class Dossier < ApplicationRecord
INSTRUCTION_COMMENCEE.include?(state)
end
def reset!
etablissement.destroy
update_columns(autorisation_donnees: false)
end
def read_only?
en_instruction? || accepte? || refuse? || sans_suite? || procedure.discarded? || procedure.close? && brouillon?
end

View file

@ -370,30 +370,6 @@ describe Dossier do
end
end
describe '#reset!' do
let!(:dossier) { create :dossier, :with_entreprise, autorisation_donnees: true }
subject { dossier.reset! }
it { expect(dossier.etablissement).not_to be_nil }
it { expect(dossier.etablissement.exercices).not_to be_empty }
it { expect(dossier.etablissement.exercices.size).to eq 1 }
it { expect(dossier.autorisation_donnees).to be_truthy }
it { expect { subject }.to change(Exercice, :count).by(-1) }
it { expect { subject }.to change(Etablissement, :count).by(-1) }
context 'when method reset! is call' do
before do
subject
dossier.reload
end
it { expect(dossier.etablissement).to be_nil }
it { expect(dossier.autorisation_donnees).to be_falsey }
end
end
describe '#champs' do
let(:procedure) { create(:procedure) }
let!(:tdc_1) { create(:type_de_champ, libelle: 'l1', position: 1, procedure: procedure) }