organizations_spec.rb 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. require 'rails_helper'
  3. require 'system/examples/pagination_examples'
  4. RSpec.describe 'Manage > Organizations', type: :system do
  5. context 'custom attribute' do
  6. context 'text' do
  7. context 'linktemplate' do
  8. it 'creates record', db_strategy: :reset do
  9. # required to edit attribute in admin interface
  10. screens = { create: { 'admin.organization': { shown: true, required: false } } }
  11. attribute = create(:object_manager_attribute_text,
  12. object_name: 'Organization',
  13. screens: screens,
  14. additional_data_options: { linktemplate: 'https://example.com' })
  15. ObjectManager::Attribute.migration_execute
  16. refresh
  17. visit 'manage/organizations'
  18. within(:active_content) do
  19. click '[data-type="new"]'
  20. end
  21. name = "Organization #{SecureRandom.uuid}"
  22. in_modal do
  23. fill_in 'name', with: name
  24. fill_in attribute.name, with: 'value'
  25. click '.js-submit'
  26. end
  27. within(:active_content) do
  28. expect(page).to have_text name
  29. end
  30. end
  31. end
  32. end
  33. end
  34. context 'ajax pagination' do
  35. include_examples 'pagination', model: :organization, klass: Organization, path: 'manage/organizations'
  36. end
  37. end