organizations_spec.rb 1.2 KB

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