-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Corrige l'erreur undefined method
upcase
dans connexion_espace_jeu
rollbar : https://app.rollbar.com/a/eva-betagouv/fix/item/eva/1002 ``` NoMethodError: undefined method `upcase' for ["94102"]:Array code = params[:code].upcase ```
- Loading branch information
1 parent
d2fa8d6
commit 62a90de
Showing
2 changed files
with
49 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'rails_helper' | ||
|
||
describe Eva::Devise::SessionsController, type: :controller do | ||
let!(:compte) { create :compte_admin } | ||
let!(:campagne) { create :campagne, compte: compte, code: 'CODECAMPAGNE' } | ||
describe 'POST connexion_espace_jeu' do | ||
context 'quand on passe un code campagne valide' do | ||
it "redirige vers l'espace jeu" do | ||
params = { | ||
code: 'codecampagne' | ||
} | ||
|
||
@request.env['devise.mapping'] = Devise.mappings[:compte] | ||
post :connexion_espace_jeu, params: params | ||
expect(response).to redirect_to('http://localhost:7700/jeu?code=CODECAMPAGNE') | ||
end | ||
end | ||
|
||
context 'retourne vers la pae de login' do | ||
it 'quand on ne passe pas de code campagne' do | ||
@request.env['devise.mapping'] = Devise.mappings[:compte] | ||
post :connexion_espace_jeu, params: {} | ||
expect(response).to redirect_to( | ||
new_compte_session_path( | ||
code_erreur: I18n.t('active_admin.devise.login.evaluations.code_invalide') | ||
) | ||
) | ||
end | ||
|
||
it 'quand on passe un code campagne vide' do | ||
@request.env['devise.mapping'] = Devise.mappings[:compte] | ||
post :connexion_espace_jeu, params: { | ||
code: '' | ||
} | ||
expect(response).to redirect_to( | ||
new_compte_session_path( | ||
code: '', | ||
code_erreur: I18n.t('active_admin.devise.login.evaluations.code_invalide') | ||
) | ||
) | ||
end | ||
end | ||
end | ||
end |