diff --git a/app/controllers/users/dossiers_controller.rb b/app/controllers/users/dossiers_controller.rb index 7719487a1..45659b21a 100644 --- a/app/controllers/users/dossiers_controller.rb +++ b/app/controllers/users/dossiers_controller.rb @@ -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) diff --git a/spec/controllers/users/dossiers_controller_spec.rb b/spec/controllers/users/dossiers_controller_spec.rb index 1af29f9b0..ec6e67aa7 100644 --- a/spec/controllers/users/dossiers_controller_spec.rb +++ b/spec/controllers/users/dossiers_controller_spec.rb @@ -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