Browse Source

Do not create a new DPO for orgs created within user factories

pull/2507/head
Kat 2 years ago
parent
commit
9ebd4c9ab5
  1. 12
      spec/factories/user.rb

12
spec/factories/user.rb

@ -3,7 +3,7 @@ FactoryBot.define do
sequence(:email) { "test#{SecureRandom.hex}@example.com" }
name { "Danny Rojas" }
password { "pAssword1" }
organisation
organisation { association :organisation, with_dsa: is_dpo ? false : true }
role { "data_provider" }
phone { "1234512345123" }
trait :data_provider do
@ -26,5 +26,15 @@ FactoryBot.define do
transient do
old_user_id { SecureRandom.uuid }
end
after(:create) do |user, _evaluator|
unless user.organisation.data_protection_confirmed?
create(
:data_protection_confirmation,
organisation: user.organisation,
data_protection_officer: user,
)
end
end
end
end

Loading…
Cancel
Save