fix tests

This commit is contained in:
Lisa Durand 2024-09-17 16:04:48 +02:00
parent fdb2ebd5d1
commit 3469eeea17
No known key found for this signature in database
GPG key ID: 0DF91F2CA1E8B816
5 changed files with 12 additions and 10 deletions

View file

@ -8,5 +8,4 @@ new_ranked_dictionary = new_frequency_lists.transform_values do |lst|
Zxcvbn::Matching.build_ranked_dict(lst) Zxcvbn::Matching.build_ranked_dict(lst)
end end
# Zxcvbn::Matching::RANKED_DICTIONARIES.merge! new_ranked_dictionary Zxcvbn::Matching::RANKED_DICTIONARIES.merge! new_ranked_dictionary
Zxcvbn::Matching::RANKED_DICTIONARIES = new_ranked_dictionary

View file

@ -37,7 +37,7 @@ describe Administrateurs::ActivateController, type: :controller do
end end
context 'when the password is not strong' do context 'when the password is not strong' do
let(:password) { 'another-password-ok?' } let(:password) { 'password-ok?' }
it { expect(administrateur.user.reload.valid_password?(password)).to be false } it { expect(administrateur.user.reload.valid_password?(password)).to be false }
it { expect(response).to redirect_to(admin_activate_path(token: token)) } it { expect(response).to redirect_to(admin_activate_path(token: token)) }

View file

@ -61,7 +61,7 @@ module SystemHelpers
confirmation_email = open_email(email) confirmation_email = open_email(email)
procedure_sign_in_link = confirmation_email.body.match(/href="([^"]*\/commencer\/[^"]*)"/)[1] procedure_sign_in_link = confirmation_email.body.match(/href="([^"]*\/commencer\/[^"]*)"/)[1]
visit procedure_sign_in_link visit URI.parse(procedure_sign_in_link).path
end end
def click_reset_password_link_for(email) def click_reset_password_link_for(email)

View file

@ -4,7 +4,7 @@ describe 'As an administrateur', js: true do
let(:super_admin) { create(:super_admin) } let(:super_admin) { create(:super_admin) }
let(:admin_email) { 'new_admin@gouv.fr' } let(:admin_email) { 'new_admin@gouv.fr' }
let(:new_admin) { Administrateur.by_email(admin_email) } let(:new_admin) { Administrateur.by_email(admin_email) }
let(:weak_password) { '12345678' } let(:weak_password) { '000000000000' }
let(:strong_password) { 'a new, long, and complicated password!' } let(:strong_password) { 'a new, long, and complicated password!' }
before do before do

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
describe 'Inviting an expert:' do describe 'Inviting an expert:', js: true do
include ActiveJob::TestHelper include ActiveJob::TestHelper
include ActionView::Helpers include ActionView::Helpers
@ -34,7 +34,8 @@ describe 'Inviting an expert:' do
end end
scenario 'I can sign-in again afterwards' do scenario 'I can sign-in again afterwards' do
click_on 'Se déconnecter' click_on(avis.expert.email.to_s, visible: true)
click_on('Se déconnecter', visible: true)
visit new_user_session_path visit new_user_session_path
sign_in_with avis.expert.email, password sign_in_with avis.expert.email, password
@ -54,9 +55,10 @@ describe 'Inviting an expert:' do
expect(page).to have_current_path(new_user_session_path) expect(page).to have_current_path(new_user_session_path)
login_as avis.expert.user, scope: :user login_as avis.expert.user, scope: :user
sign_in_with(avis.expert.email, 'This is a very complicated password !') sign_in_with(avis.expert.email, '{My-$3cure-p4ssWord}')
expect(page).to have_content("connecté en tant quexpert") expect(page).to have_content("connecté en tant quexpert")
click_on 'Passer en usager' click_on(avis.expert.email.to_s, visible: true)
click_on('Passer en usager', visible: true)
expect(page).to have_current_path(dossiers_path) expect(page).to have_current_path(dossiers_path)
end end
end end
@ -111,10 +113,11 @@ describe 'Inviting an expert:' do
expect(page).to have_text('Cet avis est confidentiel') expect(page).to have_text('Cet avis est confidentiel')
# check validation # check validation
fill_in 'avis_answer', with: 'Ma réponse dexpert.'
click_on 'Envoyer votre avis' click_on 'Envoyer votre avis'
expect(page).to have_content("Le champ « Réponse oui/non » n'est pas inclus(e) dans la liste") expect(page).to have_content("Le champ « Réponse oui/non » n'est pas inclus(e) dans la liste")
choose 'non' find('label', text: 'non').click
fill_in 'avis_answer', with: 'Ma réponse dexpert.' fill_in 'avis_answer', with: 'Ma réponse dexpert.'
click_on 'Envoyer votre avis' click_on 'Envoyer votre avis'