From 2b23eefee2d63cb2072bb4265a32d7a0e039146d Mon Sep 17 00:00:00 2001 From: clemkeirua Date: Fri, 18 Sep 2020 09:57:26 +0200 Subject: [PATCH] fix tests that now requir an admin user to have a strong password --- spec/controllers/webhook_controller_spec.rb | 2 +- spec/factories/administrateur.rb | 2 +- spec/factories/user.rb | 4 ++++ spec/services/administrateur_usage_statistics_service_spec.rb | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/spec/controllers/webhook_controller_spec.rb b/spec/controllers/webhook_controller_spec.rb index 534983c84..b5548e224 100644 --- a/spec/controllers/webhook_controller_spec.rb +++ b/spec/controllers/webhook_controller_spec.rb @@ -25,7 +25,7 @@ describe WebhookController, type: :controller do end context 'when there is a matching user' do - let(:user) { create(:user) } + let(:user) { create(:user, :with_strong_password) } let(:customer_email) { user.email } it 'returns a 200 response' do diff --git a/spec/factories/administrateur.rb b/spec/factories/administrateur.rb index c82404e2c..b665f9249 100644 --- a/spec/factories/administrateur.rb +++ b/spec/factories/administrateur.rb @@ -3,7 +3,7 @@ FactoryBot.define do factory :administrateur do transient do email { generate(:administrateur_email) } - password { 'mon chien aime les bananes' } + password { 'Mon [hien 4im3 {es banane$' } end initialize_with do diff --git a/spec/factories/user.rb b/spec/factories/user.rb index 55c6d258e..a5bcfa1a4 100644 --- a/spec/factories/user.rb +++ b/spec/factories/user.rb @@ -8,5 +8,9 @@ FactoryBot.define do trait :unconfirmed do confirmed_at { nil } end + + trait :with_strong_password do + password { '{my-%s3cure[]-p4$$w0rd' } + end end end diff --git a/spec/services/administrateur_usage_statistics_service_spec.rb b/spec/services/administrateur_usage_statistics_service_spec.rb index 835206df7..17749a21c 100644 --- a/spec/services/administrateur_usage_statistics_service_spec.rb +++ b/spec/services/administrateur_usage_statistics_service_spec.rb @@ -36,7 +36,7 @@ describe AdministrateurUsageStatisticsService do context 'for an administrateur that has plenty of things' do let(:administrateur) do create(:administrateur, - user: create(:user, sign_in_count: 17, current_sign_in_at: Time.zone.local(2019, 3, 7), last_sign_in_at: Time.zone.local(2019, 2, 27)), + user: create(:user, :with_strong_password, sign_in_count: 17, current_sign_in_at: Time.zone.local(2019, 3, 7), last_sign_in_at: Time.zone.local(2019, 2, 27)), services: [create(:service)], instructeurs: [create(:instructeur)]) end