begin controler france connect test bad code params
This commit is contained in:
parent
2f21b42c07
commit
b979c9df32
1 changed files with 20 additions and 3 deletions
|
@ -17,16 +17,33 @@ describe FranceConnectController, type: :controller do
|
|||
end
|
||||
end
|
||||
context 'when params code is present' do
|
||||
let(:code) { 'plop'}
|
||||
let(:code) { 'plop' }
|
||||
before do
|
||||
get :callback, code: code
|
||||
end
|
||||
|
||||
context 'when code is correct' do
|
||||
before do
|
||||
allow(FranceConnectService).to receive(:retrieve_user_informations).and_return(Hashie::Mash.new(email: 'patator@cake.com'))
|
||||
end
|
||||
it 'redirect to login page' do
|
||||
get :callback, code: code
|
||||
it 'redirect to dossiers list' do
|
||||
expect(response).to redirect_to(controller: 'users/dossiers', action: :index)
|
||||
end
|
||||
end
|
||||
|
||||
context 'wen code is not correct' do
|
||||
before do
|
||||
allow(FranceConnectService).to receive(:retrieve_user_informations).and_raise(Rack::OAuth2::Client::Error)
|
||||
end
|
||||
|
||||
it 'redirect to login page' do
|
||||
expect(response).to redirect_to(controller: 'users/sign_in', action: :index)
|
||||
end
|
||||
|
||||
it 'flash message error connexion with France Connect' do
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue