diff --git a/app/models/dossier.rb b/app/models/dossier.rb index 0e353de03..7d64d80c7 100644 --- a/app/models/dossier.rb +++ b/app/models/dossier.rb @@ -1,5 +1,5 @@ class Dossier < ApplicationRecord - self.ignored_columns += [:re_instructed_at, :search_terms, :private_search_terms] + self.ignored_columns += [:re_instructed_at, :search_terms, :private_search_terms, :hidden_at] include DossierCloneConcern include DossierCorrectableConcern diff --git a/spec/factories/dossier.rb b/spec/factories/dossier.rb index 133f242e1..ccc9f3c53 100644 --- a/spec/factories/dossier.rb +++ b/spec/factories/dossier.rb @@ -110,10 +110,6 @@ FactoryBot.define do archived { false } end - trait :discarded do - hidden_at { Time.zone.now } - end - trait :hidden_by_expired do hidden_by_expired_at { 1.day.ago } hidden_by_reason { DeletedDossier.reasons.fetch(:expired) } diff --git a/spec/mailers/dossier_mailer_spec.rb b/spec/mailers/dossier_mailer_spec.rb index cad8960f6..f8b639d4f 100644 --- a/spec/mailers/dossier_mailer_spec.rb +++ b/spec/mailers/dossier_mailer_spec.rb @@ -127,12 +127,8 @@ RSpec.describe DossierMailer, type: :mailer do end describe '.notify_automatic_deletion_to_user' do - # let(:deleted_dossier) { create(:deleted_dossier, dossier: dossier, reason: :expired) } - # let(:hidden_dossier) { build(:dossier, :en_construction, hidden_at: Time.zone.now, hidden_by_reason: 'expired') } - describe 'en_construction' do - # let(:dossier) { create(:dossier, :en_construction) } - let(:hidden_dossier) { create(:dossier, :en_construction, hidden_at: Time.zone.now, hidden_by_reason: 'expired') } + let(:hidden_dossier) { create(:dossier, :en_construction, hidden_by_expired_at: Time.zone.now, hidden_by_reason: 'expired') } subject { described_class.notify_automatic_deletion_to_user([hidden_dossier], hidden_dossier.user.email) } @@ -145,7 +141,7 @@ RSpec.describe DossierMailer, type: :mailer do end describe 'termine' do - let(:hidden_dossier) { create(:dossier, :accepte, hidden_at: Time.zone.now, hidden_by_reason: 'expired') } + let(:hidden_dossier) { create(:dossier, :accepte, hidden_by_expired_at: Time.zone.now, hidden_by_reason: 'expired') } subject { described_class.notify_automatic_deletion_to_user([hidden_dossier], hidden_dossier.user.email) } @@ -159,9 +155,7 @@ RSpec.describe DossierMailer, type: :mailer do end describe '.notify_automatic_deletion_to_administration' do - # let(:dossier) { create(:dossier, :en_construction) } - let(:hidden_dossier) { create(:dossier, :accepte, hidden_at: Time.zone.now, hidden_by_reason: 'expired') } - # let(:deleted_dossier) { create(:deleted_dossier, dossier: dossier, reason: :expired) } + let(:hidden_dossier) { create(:dossier, :accepte, hidden_by_expired_at: Time.zone.now, hidden_by_reason: 'expired') } subject { described_class.notify_automatic_deletion_to_administration([hidden_dossier], hidden_dossier.user.email) } diff --git a/spec/models/concerns/dossier_clone_concern_spec.rb b/spec/models/concerns/dossier_clone_concern_spec.rb index 955061672..0daad9ff2 100644 --- a/spec/models/concerns/dossier_clone_concern_spec.rb +++ b/spec/models/concerns/dossier_clone_concern_spec.rb @@ -35,7 +35,6 @@ RSpec.describe DossierCloneConcern do expect(new_dossier.en_instruction_at).to be_nil expect(new_dossier.for_procedure_preview).to be_falsey expect(new_dossier.groupe_instructeur_updated_at).to be_nil - expect(new_dossier.hidden_at).to be_nil expect(new_dossier.hidden_by_administration_at).to be_nil expect(new_dossier.hidden_by_reason).to be_nil expect(new_dossier.hidden_by_user_at).to be_nil diff --git a/spec/models/dossier_spec.rb b/spec/models/dossier_spec.rb index 096283270..43609f8f5 100644 --- a/spec/models/dossier_spec.rb +++ b/spec/models/dossier_spec.rb @@ -933,7 +933,6 @@ describe Dossier, type: :model do context 'en_construction' do it 'hide the dossier but does not discard' do - expect(dossier.hidden_at).to be_nil expect(dossier.hidden_by_user_at).to be_present end diff --git a/spec/services/expired/expired_users_deletion_service_spec.rb b/spec/services/expired/expired_users_deletion_service_spec.rb index f18eb92a9..fb2bf9fc6 100644 --- a/spec/services/expired/expired_users_deletion_service_spec.rb +++ b/spec/services/expired/expired_users_deletion_service_spec.rb @@ -72,7 +72,7 @@ describe Expired::UsersDeletionService do context 'when dossier termine' do let(:dossier) { create(:dossier, :accepte, user:, created_at: last_signed_in_expired) } - it 'marks dossier as hidden_at due to user_removal and remove user' do + it 'marks dossier as hidden by user due to user_removal and remove user' do expect { subject }.to change { dossier.reload.hidden_by_user_at }.from(nil).to(anything) expect { user.reload }.to raise_error(ActiveRecord::RecordNotFound) end