2024-04-29 00:17:15 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-01-23 17:15:42 +01:00
|
|
|
FactoryBot.define do
|
2019-08-08 16:55:51 +02:00
|
|
|
sequence(:instructeur_email) { |n| "inst#{n}@inst.com" }
|
|
|
|
|
2019-08-06 11:02:54 +02:00
|
|
|
factory :instructeur do
|
2021-11-25 15:38:01 +01:00
|
|
|
bypass_email_login_token { true }
|
|
|
|
|
2021-10-25 15:50:48 +02:00
|
|
|
user { association :user, email: email, password: password }
|
|
|
|
|
2019-08-08 16:55:51 +02:00
|
|
|
transient do
|
2019-10-16 14:15:47 +02:00
|
|
|
email { generate(:instructeur_email) }
|
2024-09-03 17:45:37 +02:00
|
|
|
password { '{My-$3cure-p4ssWord}' }
|
2024-09-10 16:15:30 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
trait :email_verified do
|
|
|
|
after(:create) do |instructeur|
|
|
|
|
instructeur.user.update(email_verified_at: Time.zone.now)
|
|
|
|
end
|
2019-08-08 16:55:51 +02:00
|
|
|
end
|
2023-12-12 14:23:42 +01:00
|
|
|
|
|
|
|
trait :with_agent_connect_information do
|
|
|
|
after(:create) do |instructeur, _evaluator|
|
|
|
|
create(:agent_connect_information, instructeur: instructeur)
|
|
|
|
end
|
|
|
|
end
|
2015-09-22 10:15:12 +02:00
|
|
|
end
|
2017-04-04 15:27:04 +02:00
|
|
|
end
|