remove hidden at column from dossiers

This commit is contained in:
Lisa Durand 2024-08-22 11:14:55 +02:00
parent 9ed2de9bb7
commit b586f23009
No known key found for this signature in database
GPG key ID: 0DF91F2CA1E8B816
6 changed files with 5 additions and 17 deletions

View file

@ -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

View file

@ -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) }

View file

@ -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) }

View file

@ -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

View file

@ -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

View file

@ -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