done spec france connect controller

This commit is contained in:
Xavier J 2015-10-06 17:06:37 +02:00
parent c57cb5b75d
commit a4661c932f
2 changed files with 4 additions and 3 deletions

View file

@ -27,6 +27,7 @@ class FranceConnectController < ApplicationController
end
rescue Rack::OAuth2::Client::Error => e
Rails.logger.error e.message
flash.alert = 'Erreur lors de la connexion à France Connect.'
redirect_to(new_user_session_path)
end
end

View file

@ -32,15 +32,15 @@ describe FranceConnectController, type: :controller do
context 'wen code is not correct' do
before do
allow(FranceConnectService).to receive(:retrieve_user_informations) { raise Rack::OAuth2::Client::Error.new(500, error: 'Unknown') }
get :callback, code: code
end
it 'redirect to login page' do
get :callback, code: code
expect(response).to redirect_to(new_user_session_path)
end
it 'flash message error connexion with France Connect' do
it 'display error message' do
expect(flash[:alert]).to be_present
end
end
end