organizations_spec.rb 1.4 KB

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