Skip to content

Commit

Permalink
remove hidden at column from dossiers
Browse files Browse the repository at this point in the history
  • Loading branch information
lisa-durand committed Aug 22, 2024
1 parent 9ed2de9 commit b586f23
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 17 deletions.
2 changes: 1 addition & 1 deletion app/models/dossier.rb
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 0 additions & 4 deletions spec/factories/dossier.rb
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,6 @@
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) }
Expand Down
12 changes: 3 additions & 9 deletions spec/mailers/dossier_mailer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,8 @@ def notify_deletion_to_administration(hidden_dossier, to_email)
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) }

Expand All @@ -145,7 +141,7 @@ def notify_deletion_to_administration(hidden_dossier, to_email)
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) }

Expand All @@ -159,9 +155,7 @@ def notify_deletion_to_administration(hidden_dossier, to_email)
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) }

Expand Down
1 change: 0 additions & 1 deletion spec/models/concerns/dossier_clone_concern_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
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
Expand Down
1 change: 0 additions & 1 deletion spec/models/dossier_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -933,7 +933,6 @@

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@

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
Expand Down

0 comments on commit b586f23

Please sign in to comment.