calendar_subscriptions_spec.rb 989 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. # Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
  2. require 'rails_helper'
  3. RSpec.describe 'iCal endpoints', type: :request do
  4. context 'with no existing session' do
  5. it 'gives HTTP Basic auth prompt (#3064)' do
  6. get '/ical/tickets'
  7. expect(response.body).to eq("HTTP Basic: Access denied.\n")
  8. end
  9. end
  10. describe 'time zone', authenticated_as: :user do
  11. let(:group) { create(:group) }
  12. let(:user) { create(:agent) }
  13. before do
  14. user.groups << group
  15. create(:ticket, group: group, owner: user, state_name: 'open', pending_time: 1.day.ago)
  16. end
  17. it 'returns zero offset time if no time zone set' do
  18. get '/ical/tickets'
  19. expect(response.body).to match %r{DTSTART:\d{8}T0{6}Z}
  20. end
  21. it 'returns selected time zone' do
  22. Setting.set 'timezone_default', 'Europe/Vilnius'
  23. get '/ical/tickets'
  24. expect(response.body).to match %r{DTSTART;TZID=Europe/Vilnius:\d{8}T0{6}}
  25. end
  26. end
  27. end