From a4661c932f9e34032e3fb4a71ac9d57fb7d1a92d Mon Sep 17 00:00:00 2001 From: Xavier J Date: Tue, 6 Oct 2015 17:06:37 +0200 Subject: [PATCH] done spec france connect controller --- app/controllers/france_connect_controller.rb | 1 + spec/controllers/france_connect_controller_spec.rb | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/controllers/france_connect_controller.rb b/app/controllers/france_connect_controller.rb index e14d4f037..3886f274b 100644 --- a/app/controllers/france_connect_controller.rb +++ b/app/controllers/france_connect_controller.rb @@ -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 \ No newline at end of file diff --git a/spec/controllers/france_connect_controller_spec.rb b/spec/controllers/france_connect_controller_spec.rb index 9ff5e7b14..1e0b8ab8c 100644 --- a/spec/controllers/france_connect_controller_spec.rb +++ b/spec/controllers/france_connect_controller_spec.rb @@ -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