role.rb 645 B

12345678910111213141516171819202122232425262728293031
  1. # Copyright (C) 2012-2023 Zammad Foundation, https://zammad-foundation.org/
  2. FactoryBot.define do
  3. factory :role do
  4. sequence(:name) { |n| "TestRole#{n}" }
  5. created_by_id { 1 }
  6. updated_by_id { 1 }
  7. transient do
  8. permission_names { nil }
  9. end
  10. permissions { Permission.where(name: permission_names) }
  11. trait :agent do
  12. permission_names { 'ticket.agent' }
  13. end
  14. trait :customer do
  15. permission_names { 'ticket.customer' }
  16. end
  17. trait :admin do
  18. permission_names { 'admin' }
  19. end
  20. trait :admin_core_workflow do
  21. permission_names { 'admin.core_workflow' }
  22. end
  23. end
  24. end