update identity_updated_at column when user identity change

This commit is contained in:
simon lehericey 2021-10-04 10:04:07 +02:00
parent 3a878dfc04
commit f662b28baf
2 changed files with 6 additions and 2 deletions

View file

@ -70,7 +70,7 @@ module Users
@dossier = dossier
if @dossier.individual.update(individual_params)
@dossier.update!(autorisation_donnees: true)
@dossier.update!(autorisation_donnees: true, identity_updated_at: Time.zone.now)
flash.notice = t('.identity_saved')
redirect_to brouillon_dossier_path(@dossier)

View file

@ -151,12 +151,15 @@ describe Users::DossiersController, type: :controller do
describe 'update_identite' do
let(:procedure) { create(:procedure, :for_individual) }
let(:dossier) { create(:dossier, user: user, procedure: procedure) }
let(:now) { Time.zone.parse('01/01/2100') }
subject { post :update_identite, params: { id: dossier.id, individual: individual_params } }
before do
sign_in(user)
subject
Timecop.freeze(now) do
subject
end
end
context 'with correct individual and dossier params' do
@ -164,6 +167,7 @@ describe Users::DossiersController, type: :controller do
it do
expect(response).to redirect_to(brouillon_dossier_path(dossier))
expect(dossier.reload.identity_updated_at).to eq(now)
end
end