fix tests
This commit is contained in:
parent
fdb2ebd5d1
commit
3469eeea17
5 changed files with 12 additions and 10 deletions
|
@ -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
|
|
||||||
|
|
|
@ -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)) }
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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 qu’expert")
|
expect(page).to have_content("connecté en tant qu’expert")
|
||||||
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 d’expert.'
|
||||||
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 d’expert.'
|
fill_in 'avis_answer', with: 'Ma réponse d’expert.'
|
||||||
click_on 'Envoyer votre avis'
|
click_on 'Envoyer votre avis'
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue