organization_profile_spec.rb 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. # Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
  2. require 'rails_helper'
  3. RSpec.describe 'Organization Profile', type: :system do
  4. context 'members section' do
  5. let(:organization) { create(:organization) }
  6. let(:members) { organization.members.order(id: :asc) }
  7. before do
  8. create_list(:customer, 50, organization: organization)
  9. visit "#organization/profile/#{organization.id}"
  10. end
  11. it 'shows first 10 members and loads more on demand' do
  12. expect(page).to have_text(members[9].fullname)
  13. expect(page).to have_no_text(members[10].fullname)
  14. click '.js-showMoreMembers'
  15. expect(page).to have_text(members[10].fullname)
  16. end
  17. end
  18. context 'when ticket changes in organization profile', authenticated_as: :authenticate do
  19. let(:ticket) { create(:ticket, title: SecureRandom.uuid, customer: create(:customer, :with_org), group: Group.first) }
  20. def authenticate
  21. ticket
  22. true
  23. end
  24. before do
  25. visit "#organization/profile/#{ticket.customer.organization.id}"
  26. end
  27. it 'does update when ticket changes' do
  28. expect(page).to have_text(ticket.title)
  29. ticket.update(title: SecureRandom.uuid)
  30. expect(page).to have_text(ticket.title)
  31. end
  32. end
  33. end