done spec france connect controller
This commit is contained in:
parent
c57cb5b75d
commit
a4661c932f
2 changed files with 4 additions and 3 deletions
|
@ -27,6 +27,7 @@ class FranceConnectController < ApplicationController
|
||||||
end
|
end
|
||||||
rescue Rack::OAuth2::Client::Error => e
|
rescue Rack::OAuth2::Client::Error => e
|
||||||
Rails.logger.error e.message
|
Rails.logger.error e.message
|
||||||
|
flash.alert = 'Erreur lors de la connexion à France Connect.'
|
||||||
redirect_to(new_user_session_path)
|
redirect_to(new_user_session_path)
|
||||||
end
|
end
|
||||||
end
|
end
|
|
@ -32,15 +32,15 @@ describe FranceConnectController, type: :controller do
|
||||||
context 'wen code is not correct' do
|
context 'wen code is not correct' do
|
||||||
before do
|
before do
|
||||||
allow(FranceConnectService).to receive(:retrieve_user_informations) { raise Rack::OAuth2::Client::Error.new(500, error: 'Unknown') }
|
allow(FranceConnectService).to receive(:retrieve_user_informations) { raise Rack::OAuth2::Client::Error.new(500, error: 'Unknown') }
|
||||||
|
get :callback, code: code
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'redirect to login page' do
|
it 'redirect to login page' do
|
||||||
get :callback, code: code
|
|
||||||
expect(response).to redirect_to(new_user_session_path)
|
expect(response).to redirect_to(new_user_session_path)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'flash message error connexion with France Connect' do
|
it 'display error message' do
|
||||||
|
expect(flash[:alert]).to be_present
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue