calendars_spec.rb 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. # Copyright (C) 2012-2023 Zammad Foundation, https://zammad-foundation.org/
  2. require 'rails_helper'
  3. RSpec.describe 'Manage > Calendars', type: :system do
  4. context 'Date' do
  5. let(:calendar_title) { "test calendar #{SecureRandom.uuid}" }
  6. it 'show festivity dates correctly far away from UTC', time_zone: 'America/Sao_Paulo' do
  7. visit '/#manage/calendars'
  8. click '.js-new'
  9. in_modal do
  10. fill_in 'name', with: calendar_title
  11. click '.dropdown-toggle'
  12. click '.dropdown-menu [data-value="America/Sao_Paulo"]'
  13. find('.ical_feed select').select 'Brazil'
  14. click '.js-submit'
  15. end
  16. within :active_content do
  17. within '.action', text: calendar_title do
  18. find('.js-edit').click
  19. end
  20. end
  21. in_modal do
  22. # Check that holidays were imported by looking at the first entry.
  23. expect(find('.holiday_selector tbody tr:first-child td:nth-child(2)').text).to match(%r{^\d{4}-\d{2}-\d{2}$})
  24. expect(find('.holiday_selector tbody tr:first-child td input.js-summary').value).to be_present
  25. end
  26. end
  27. end
  28. # https://github.com/zammad/zammad/issues/2528
  29. context 'ical feed - subscribe to public holidays in another country' do
  30. it 'shows countries dropdown in sorted order' do
  31. allow(Calendar).to receive(:ical_feeds).and_return({
  32. 'https://argentinien.de': 'Argentinien',
  33. 'https://australien.de': 'Australien',
  34. 'https://osterreich.de': 'Österreich',
  35. 'https://weibrussland.de': 'Weißrussland',
  36. 'https://kanada.de': 'Kanada',
  37. 'https://chile.de': 'Chile',
  38. })
  39. visit '/#manage/calendars'
  40. click '.js-new'
  41. in_modal do
  42. expect(all('.ical_feed select option').map(&:text)).to eq ['-', 'Argentinien', 'Australien', 'Chile', 'Kanada', 'Österreich', 'Weißrussland']
  43. end
  44. end
  45. end
  46. end