add template_accesses factory
This commit is contained in:
committed by
Pete Matsyburka
parent
0fb9c2bbf6
commit
23631b75f2
@@ -0,0 +1,8 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
FactoryBot.define do
|
||||
factory :template_access do
|
||||
template
|
||||
user
|
||||
end
|
||||
end
|
||||
@@ -14,6 +14,7 @@ FactoryBot.define do
|
||||
%w[text date checkbox radio signature number multiple select initials image file stamp cells phone payment]
|
||||
end
|
||||
except_field_types { [] }
|
||||
private_access_user { nil }
|
||||
end
|
||||
|
||||
after(:create) do |template, ev|
|
||||
@@ -343,5 +344,17 @@ FactoryBot.define do
|
||||
|
||||
template.save!
|
||||
end
|
||||
|
||||
trait :with_admin_only_access do
|
||||
after(:create) do |template|
|
||||
create(:template_access, template:, user_id: TemplateAccess::ADMIN_USER_ID)
|
||||
end
|
||||
end
|
||||
|
||||
trait :with_private_access do
|
||||
after(:create) do |template, ev|
|
||||
create(:template_access, template:, user: ev.private_access_user || template.author)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user