Merge pull request #10040 from colinux/cross-domain-component

Prépare la bannière informant du changement de nom de domaine, avec redirection automatique le cas échéant
This commit is contained in:
Colin Darie 2024-03-21 14:58:29 +00:00 committed by GitHub
commit 17f9992722
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
24 changed files with 218 additions and 16 deletions

View file

@ -42,6 +42,10 @@ describe Users::RegistrationsController, type: :controller do
post :create, params: { user: user }
end
before do
allow(Current).to receive(:host).and_return(ENV.fetch("APP_HOST"))
end
context 'when user is correct' do
it 'sends confirmation instruction' do
message = double()
@ -49,6 +53,8 @@ describe Users::RegistrationsController, type: :controller do
expect(message).to receive(:deliver_later)
subject
expect(User.last.preferred_domain_demarches_gouv_fr?).to be_truthy
end
end

View file

@ -65,6 +65,18 @@ describe Users::SessionsController, type: :controller do
expect(flash.alert).to eq("Adresse électronique ou mot de passe incorrect.")
end
end
context 'when user has not yet a preferred domain' do
before do
allow(Current).to receive(:host).and_return(ENV.fetch("APP_HOST"))
end
it 'update preferred domain' do
subject
expect(user.reload.preferred_domain_demarches_gouv_fr?).to be_truthy
end
end
end
context 'when the credentials are wrong' do