organizations_spec.rb 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. # Copyright (C) 2012-2021 Zammad Foundation, http://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 = { edit: { '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. modal_ready
  22. name = "Organization #{rand(999_999)}"
  23. within '.modal-dialog' do
  24. fill_in 'name', with: name
  25. fill_in attribute.name, with: 'value'
  26. click '.js-submit'
  27. end
  28. modal_disappear
  29. within(:active_content) do
  30. expect(page).to have_text name
  31. end
  32. end
  33. end
  34. end
  35. end
  36. context 'ajax pagination' do
  37. include_examples 'pagination', model: :organization, klass: Organization, path: 'manage/organizations'
  38. end
  39. end