auth: move the FranceConnect button to a partial

This commit is contained in:
Pierre de La Morinerie 2019-04-02 15:03:26 +02:00 committed by Mathieu Magnin
parent 4e6f20f660
commit 28dcbcb85b
6 changed files with 43 additions and 46 deletions

View file

@ -1,6 +1,6 @@
require 'spec_helper'
feature 'France Connect Particulier Connexion' do
feature 'France Connect Particulier Connexion' do
let(:code) { 'plop' }
let(:given_name) { 'titi' }
let(:family_name) { 'toto' }
@ -28,7 +28,7 @@ feature 'France Connect Particulier Connexion' do
end
scenario 'link to France Connect is present' do
expect(page).to have_css('a.login-with-fc')
expect(page).to have_css('.france-connect-login-button')
end
context 'and click on france connect link' do
@ -53,7 +53,7 @@ feature 'France Connect Particulier Connexion' do
context 'when is the first connexion' do
before do
page.find('.login-with-fc').click
page.find('.france-connect-login-button').click
end
scenario 'he is redirected to user dossiers page' do
@ -64,7 +64,7 @@ feature 'France Connect Particulier Connexion' do
context 'when is not the first connexion' do
before do
create(:user, france_connect_information: france_connect_information)
page.find('.login-with-fc').click
page.find('.france-connect-login-button').click
end
scenario 'he is redirected to user dossiers page' do
@ -77,11 +77,11 @@ feature 'France Connect Particulier Connexion' do
before do
allow_any_instance_of(FranceConnectParticulierClient).to receive(:authorization_uri).and_return(france_connect_particulier_callback_path(code: code))
allow(FranceConnectService).to receive(:retrieve_user_informations_particulier) { raise Rack::OAuth2::Client::Error.new(500, error: 'Unknown') }
page.find('.login-with-fc').click
page.find('.france-connect-login-button').click
end
scenario 'he is redirected to login page' do
expect(page).to have_css('a.login-with-fc')
expect(page).to have_css('.france-connect-login-button')
end
scenario 'error message is displayed' do