2018-01-23 17:15:42 +01:00
|
|
|
FactoryBot.define do
|
2017-06-01 17:44:56 +02:00
|
|
|
sequence(:administrateur_email) { |n| "admin#{n}@admin.com" }
|
2015-10-26 15:54:20 +01:00
|
|
|
factory :administrateur do
|
|
|
|
email { generate(:administrateur_email) }
|
2018-01-25 10:50:06 +01:00
|
|
|
password { 'mon chien aime les bananes' }
|
2019-01-07 15:11:55 +01:00
|
|
|
|
|
|
|
after(:create) do |admin|
|
|
|
|
create(:gestionnaire, email: admin.email, password: admin.password)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
trait :with_admin_trusted_device do
|
|
|
|
after(:create) do |admin|
|
|
|
|
admin.gestionnaire.update(features: { "enable_email_login_token" => true })
|
|
|
|
end
|
2015-10-26 15:54:20 +01:00
|
|
|
end
|
2018-08-24 15:53:57 +02:00
|
|
|
|
|
|
|
trait :with_api_token do
|
|
|
|
after(:create) do |admin|
|
|
|
|
admin.renew_api_token
|
|
|
|
end
|
|
|
|
end
|
2019-01-03 17:42:43 +01:00
|
|
|
|
|
|
|
trait :with_procedure do
|
|
|
|
after(:create) do |admin|
|
|
|
|
admin.procedures << create(:simple_procedure, administrateur: admin)
|
|
|
|
end
|
|
|
|
end
|
2017-04-04 15:27:04 +02:00
|
|
|
end
|